Skip to content

Instantly share code, notes, and snippets.

@wicadmin
Forked from tsertkov/README.md
Created March 28, 2020 15:59
Show Gist options
  • Select an option

  • Save wicadmin/95ca52ceffa8da8922a263475f698352 to your computer and use it in GitHub Desktop.

Select an option

Save wicadmin/95ca52ceffa8da8922a263475f698352 to your computer and use it in GitHub Desktop.

Revisions

  1. @tsertkov tsertkov revised this gist Jan 18, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,4 @@ $ kubectl port-forward "$(kubectl get pods -l run=node-hello -o jsonpath='{.item

    ## cloud-config.full.1.7.yaml

    Provisions kubernetes stable-1.7 with dashboard and superuser account.
    Same as cloud-config.full.yaml but for Kubernetes 1.7
  2. @tsertkov tsertkov revised this gist Jan 18, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,7 @@ It is assumed that `ubuntu` user is already created on the system.
    kubeadm k8s installation including:
    - superuser with admin priveleges
    - dashboard addon
    - fixes internet in pods

    ```
    $ kubectl proxy
  3. @tsertkov tsertkov revised this gist Jan 18, 2018. 2 changed files with 8 additions and 4 deletions.
    6 changes: 4 additions & 2 deletions cloud-config.full.1.7.yaml
    Original file line number Diff line number Diff line change
    @@ -34,14 +34,16 @@ write_files:
    - path: /etc/systemd/system/kubernetes-pods-enable-forward.service
    content: |
    [Unit]
    Description=Enable internet for k8s pods
    After=systemd-sysctl.service
    Description=Forward k8s pods network
    DefaultDependencies=false
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/sbin/iptables -A FORWARD -d 10.22.0.0/16 -j ACCEPT
    ExecStart=/sbin/iptables -A FORWARD -s 10.22.0.0/16 -j ACCEPT
    ExecStop=
    [Install]
    WantedBy=sysinit.target
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
    6 changes: 4 additions & 2 deletions cloud-config.full.yaml
    Original file line number Diff line number Diff line change
    @@ -34,14 +34,16 @@ write_files:
    - path: /etc/systemd/system/kubernetes-pods-enable-forward.service
    content: |
    [Unit]
    Description=Enable internet for k8s pods
    After=systemd-sysctl.service
    Description=Forward k8s pods network
    DefaultDependencies=false
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/sbin/iptables -A FORWARD -d 10.22.0.0/16 -j ACCEPT
    ExecStart=/sbin/iptables -A FORWARD -s 10.22.0.0/16 -j ACCEPT
    ExecStop=
    [Install]
    WantedBy=sysinit.target
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
  4. @tsertkov tsertkov revised this gist Jan 18, 2018. 2 changed files with 30 additions and 4 deletions.
    17 changes: 15 additions & 2 deletions cloud-config.full.1.7.yaml
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,17 @@ packages:
    - kubectl
    - [kubeadm, 1.7.10-00]
    write_files:
    - path: /etc/systemd/system/kubernetes-pods-enable-forward.service
    content: |
    [Unit]
    Description=Enable internet for k8s pods
    After=systemd-sysctl.service
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/sbin/iptables -A FORWARD -d 10.22.0.0/16 -j ACCEPT
    ExecStart=/sbin/iptables -A FORWARD -s 10.22.0.0/16 -j ACCEPT
    ExecStop=
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
    @@ -69,12 +80,14 @@ write_files:
    }
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print --skip-preflight-checks --kubernetes-version stable-1.7
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/superuser.yaml
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.7.1/src/deploy/recommended/kubernetes-dashboard.yaml
    - systemctl daemon-reload
    - systemctl enable kubernetes-pods-enable-forward.service
    - systemctl start kubernetes-pods-enable-forward.service
    - usermod -a -G docker ubuntu
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
    17 changes: 15 additions & 2 deletions cloud-config.full.yaml
    Original file line number Diff line number Diff line change
    @@ -31,6 +31,17 @@ packages:
    - kubectl
    - kubeadm
    write_files:
    - path: /etc/systemd/system/kubernetes-pods-enable-forward.service
    content: |
    [Unit]
    Description=Enable internet for k8s pods
    After=systemd-sysctl.service
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/sbin/iptables -A FORWARD -d 10.22.0.0/16 -j ACCEPT
    ExecStart=/sbin/iptables -A FORWARD -s 10.22.0.0/16 -j ACCEPT
    ExecStop=
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
    @@ -69,12 +80,14 @@ write_files:
    }
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/superuser.yaml
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
    - systemctl daemon-reload
    - systemctl enable kubernetes-pods-enable-forward.service
    - systemctl start kubernetes-pods-enable-forward.service
    - usermod -a -G docker ubuntu
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
  5. @tsertkov tsertkov revised this gist Jan 15, 2018. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion cloud-config.minimal.yaml
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,6 @@ write_files:
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    power_state:
  6. @tsertkov tsertkov revised this gist Jan 15, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion cloud-config.full.1.7.yaml
    Original file line number Diff line number Diff line change
    @@ -71,7 +71,7 @@ write_files:
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print --kubernetes-version stable-1.7
    - kubeadm init --skip-token-print --skip-preflight-checks --kubernetes-version stable-1.7
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/superuser.yaml
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.7.1/src/deploy/recommended/kubernetes-dashboard.yaml
  7. @tsertkov tsertkov revised this gist Jan 15, 2018. 2 changed files with 85 additions and 8 deletions.
    10 changes: 2 additions & 8 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -26,12 +26,6 @@ $ kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=808
    $ kubectl port-forward "$(kubectl get pods -l run=node-hello -o jsonpath='{.items[0].metadata.name}')" 8080:8080
    ```

    ## Install specific version of kubernetes
    ## cloud-config.full.1.7.yaml

    Latest stable version of kubernetes is installed by default by kubeadm. To install specific version of kubernetes corresponding version of kubeadm must be installed.

    ```
    // install kubernetes 1.7.12
    $ apt-get install kubeadm=1.7.10-00
    $ kubeadm init --kubernetes-version stable-1.7
    ```
    Provisions kubernetes stable-1.7 with dashboard and superuser account.
    83 changes: 83 additions & 0 deletions cloud-config.full.1.7.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    #cloud-config
    apt:
    sources:
    kubernetes:
    source: "deb http://apt.kubernetes.io/ kubernetes-xenial main"
    # key from https://packages.cloud.google.com/apt/doc/apt-key.gpg
    key: |
    -----BEGIN PGP PUBLIC KEY BLOCK-----
    Version: GnuPG v1
    mQENBFUd6rIBCAD6mhKRHDn3UrCeLDp7U5IE7AhhrOCPpqGF7mfTemZYHf/5Jdjx
    cOxoSFlK7zwmFr3lVqJ+tJ9L1wd1K6P7RrtaNwCiZyeNPf/Y86AJ5NJwBe0VD0xH
    TXzPNTqRSByVYtdN94NoltXUYFAAPZYQls0x0nUD1hLMlOlC2HdTPrD1PMCnYq/N
    uL/Vk8sWrcUt4DIS+0RDQ8tKKe5PSV0+PnmaJvdF5CKawhh0qGTklS2MXTyKFoqj
    XgYDfY2EodI9ogT/LGr9Lm/+u4OFPvmN9VN6UG+s0DgJjWvpbmuHL/ZIRwMEn/tp
    uneaLTO7h1dCrXC849PiJ8wSkGzBnuJQUbXnABEBAAG0QEdvb2dsZSBDbG91ZCBQ
    YWNrYWdlcyBBdXRvbWF0aWMgU2lnbmluZyBLZXkgPGdjLXRlYW1AZ29vZ2xlLmNv
    bT6JAT4EEwECACgFAlUd6rICGy8FCQWjmoAGCwkIBwMCBhUIAgkKCwQWAgMBAh4B
    AheAAAoJEDdGwginMXsPcLcIAKi2yNhJMbu4zWQ2tM/rJFovazcY28MF2rDWGOnc
    9giHXOH0/BoMBcd8rw0lgjmOosBdM2JT0HWZIxC/Gdt7NSRA0WOlJe04u82/o3OH
    WDgTdm9MS42noSP0mvNzNALBbQnlZHU0kvt3sV1YsnrxljoIuvxKWLLwren/GVsh
    FLPwONjw3f9Fan6GWxJyn/dkX3OSUGaduzcygw51vksBQiUZLCD2Tlxyr9NvkZYT
    qiaWW78L6regvATsLc9L/dQUiSMQZIK6NglmHE+cuSaoK0H4ruNKeTiQUw/EGFaL
    ecay6Qy/s3Hk7K0QLd+gl0hZ1w1VzIeXLo2BRlqnjOYFX4A=
    =HVTm
    -----END PGP PUBLIC KEY BLOCK-----
    package_upgrade: true
    packages:
    - docker.io
    - kubelet
    - kubectl
    - [kubeadm, 1.7.10-00]
    write_files:
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: superuser
    namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRoleBinding
    metadata:
    name: superuser
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: cluster-admin
    subjects:
    - kind: ServiceAccount
    name: superuser
    namespace: kube-system
    - path: /etc/cni/net.d/10-cni.json
    content: |
    {
    "cniVersion": "0.2.0",
    "name": "my-kubenet",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
    "type": "host-local",
    "subnet": "10.22.0.0/16",
    "routes": [
    { "dst": "0.0.0.0/0" }
    ]
    }
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print --kubernetes-version stable-1.7
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/superuser.yaml
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.7.1/src/deploy/recommended/kubernetes-dashboard.yaml
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
    power_state:
    timeout: 300
    mode: reboot
  8. @tsertkov tsertkov revised this gist Jan 15, 2018. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,14 @@ $ open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubern
    // deploy hello-world app and proxy it to http://localhost:8080/
    $ kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
    $ kubectl port-forward "$(kubectl get pods -l run=node-hello -o jsonpath='{.items[0].metadata.name}')" 8080:8080
    ```

    ## Install specific version of kubernetes

    Latest stable version of kubernetes is installed by default by kubeadm. To install specific version of kubernetes corresponding version of kubeadm must be installed.

    ```
    // install kubernetes 1.7.12
    $ apt-get install kubeadm=1.7.10-00
    $ kubeadm init --kubernetes-version stable-1.7
    ```
  9. @tsertkov tsertkov revised this gist Jan 15, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -17,11 +17,11 @@ kubeadm k8s installation including:
    ```
    $ kubectl proxy
    # copy superuser access token to clipboard (macOS)
    // copy superuser access token to clipboard (macOS)
    $ kubectl get secret "$(kubectl get serviceAccount superuser -n kube-system -o jsonpath='{.secrets[0].name}')" -n kube-system -o jsonpath='{.data.token}' | base64 -D | pbcopy
    $ open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    # deploy hello-world app and proxy it to http://localhost:8080/
    // deploy hello-world app and proxy it to http://localhost:8080/
    $ kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
    $ kubectl port-forward "$(kubectl get pods -l run=node-hello -o jsonpath='{.items[0].metadata.name}')" 8080:8080
    ```
  10. @tsertkov tsertkov revised this gist Jan 15, 2018. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,12 @@ kubeadm k8s installation including:

    ```
    $ kubectl proxy
    $ kubectl get secret "$(kubectl get serviceAccount superuser -n kube-system -o jsonpath='{.secrets[0].name}')" -n kube-system -o jsonpath='{.data.token}' | base64 -D
    # copy superuser access token to clipboard (macOS)
    $ kubectl get secret "$(kubectl get serviceAccount superuser -n kube-system -o jsonpath='{.secrets[0].name}')" -n kube-system -o jsonpath='{.data.token}' | base64 -D | pbcopy
    $ open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    ```
    # deploy hello-world app and proxy it to http://localhost:8080/
    $ kubectl run node-hello --image=gcr.io/google-samples/node-hello:1.0 --port=8080
    $ kubectl port-forward "$(kubectl get pods -l run=node-hello -o jsonpath='{.items[0].metadata.name}')" 8080:8080
    ```
  11. @tsertkov tsertkov revised this gist Jan 14, 2018. 2 changed files with 3 additions and 4 deletions.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,15 @@
    # Single-node kubernetes cluster cloud-config

    Cloud-config tested on Ubuntu 16.04.3 LTS (Xenial Xerus) running in AWS. It is assumed that `ubuntu` user is already created on the system.
    Cloud-config files for setting up k8s single-node cluster with kubeadm on Ubuntu 16.04.3 LTS (Xenial Xerus)

    ## cloud-config.minimal.yaml

    Minimal installation of k8s with kubeadm.

    ## cloud-config.full.yaml

    It is assumed that `ubuntu` user is already created on the system.

    kubeadm k8s installation including:
    - superuser with admin priveleges
    - dashboard addon
    3 changes: 0 additions & 3 deletions cloud-config.minimal.yaml
    Original file line number Diff line number Diff line change
    @@ -53,9 +53,6 @@ runcmd:
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
    power_state:
    timeout: 300
    mode: reboot
  12. @tsertkov tsertkov revised this gist Jan 14, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,10 @@ Minimal installation of k8s with kubeadm.

    kubeadm k8s installation including:
    - superuser with admin priveleges
    - dashboard addon
    - dashboard addon

    ```
    $ kubectl proxy
    $ kubectl get secret "$(kubectl get serviceAccount superuser -n kube-system -o jsonpath='{.secrets[0].name}')" -n kube-system -o jsonpath='{.data.token}' | base64 -D
    $ open http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
    ```
  13. @tsertkov tsertkov revised this gist Jan 14, 2018. 3 changed files with 94 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,13 @@
    # Single-node kubernetes cluster cloud-config

    Cloud-config prepared for Ubuntu 16.04.3 LTS (Xenial Xerus)
    Cloud-config tested on Ubuntu 16.04.3 LTS (Xenial Xerus) running in AWS. It is assumed that `ubuntu` user is already created on the system.

    ## cloud-config.minimal.yaml

    Minimal installation of k8s with kubeadm.

    ## cloud-config.full.yaml

    kubeadm k8s installation including:
    - superuser with admin priveleges
    - dashboard addon
    83 changes: 83 additions & 0 deletions cloud-config.full.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    #cloud-config
    apt:
    sources:
    kubernetes:
    source: "deb http://apt.kubernetes.io/ kubernetes-xenial main"
    # key from https://packages.cloud.google.com/apt/doc/apt-key.gpg
    key: |
    -----BEGIN PGP PUBLIC KEY BLOCK-----
    Version: GnuPG v1
    mQENBFUd6rIBCAD6mhKRHDn3UrCeLDp7U5IE7AhhrOCPpqGF7mfTemZYHf/5Jdjx
    cOxoSFlK7zwmFr3lVqJ+tJ9L1wd1K6P7RrtaNwCiZyeNPf/Y86AJ5NJwBe0VD0xH
    TXzPNTqRSByVYtdN94NoltXUYFAAPZYQls0x0nUD1hLMlOlC2HdTPrD1PMCnYq/N
    uL/Vk8sWrcUt4DIS+0RDQ8tKKe5PSV0+PnmaJvdF5CKawhh0qGTklS2MXTyKFoqj
    XgYDfY2EodI9ogT/LGr9Lm/+u4OFPvmN9VN6UG+s0DgJjWvpbmuHL/ZIRwMEn/tp
    uneaLTO7h1dCrXC849PiJ8wSkGzBnuJQUbXnABEBAAG0QEdvb2dsZSBDbG91ZCBQ
    YWNrYWdlcyBBdXRvbWF0aWMgU2lnbmluZyBLZXkgPGdjLXRlYW1AZ29vZ2xlLmNv
    bT6JAT4EEwECACgFAlUd6rICGy8FCQWjmoAGCwkIBwMCBhUIAgkKCwQWAgMBAh4B
    AheAAAoJEDdGwginMXsPcLcIAKi2yNhJMbu4zWQ2tM/rJFovazcY28MF2rDWGOnc
    9giHXOH0/BoMBcd8rw0lgjmOosBdM2JT0HWZIxC/Gdt7NSRA0WOlJe04u82/o3OH
    WDgTdm9MS42noSP0mvNzNALBbQnlZHU0kvt3sV1YsnrxljoIuvxKWLLwren/GVsh
    FLPwONjw3f9Fan6GWxJyn/dkX3OSUGaduzcygw51vksBQiUZLCD2Tlxyr9NvkZYT
    qiaWW78L6regvATsLc9L/dQUiSMQZIK6NglmHE+cuSaoK0H4ruNKeTiQUw/EGFaL
    ecay6Qy/s3Hk7K0QLd+gl0hZ1w1VzIeXLo2BRlqnjOYFX4A=
    =HVTm
    -----END PGP PUBLIC KEY BLOCK-----
    package_upgrade: true
    packages:
    - docker.io
    - kubelet
    - kubectl
    - kubeadm
    write_files:
    - path: /etc/kubernetes/superuser.yaml
    content: |
    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: superuser
    namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1beta1
    kind: ClusterRoleBinding
    metadata:
    name: superuser
    roleRef:
    apiGroup: rbac.authorization.k8s.io
    kind: ClusterRole
    name: cluster-admin
    subjects:
    - kind: ServiceAccount
    name: superuser
    namespace: kube-system
    - path: /etc/cni/net.d/10-cni.json
    content: |
    {
    "cniVersion": "0.2.0",
    "name": "my-kubenet",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
    "type": "host-local",
    "subnet": "10.22.0.0/16",
    "routes": [
    { "dst": "0.0.0.0/0" }
    ]
    }
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f /etc/kubernetes/superuser.yaml
    - kubectl --kubeconfig /etc/kubernetes/admin.conf apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
    power_state:
    timeout: 300
    mode: reboot
    File renamed without changes.
  14. @tsertkov tsertkov revised this gist Jan 14, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1 +1,3 @@
    # Cloud-config setting up single-node kubernetes cluster on Ubuntu 16.04.3 LTS (Xenial Xerus)
    # Single-node kubernetes cluster cloud-config

    Cloud-config prepared for Ubuntu 16.04.3 LTS (Xenial Xerus)
  15. @tsertkov tsertkov created this gist Jan 14, 2018.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    # Cloud-config setting up single-node kubernetes cluster on Ubuntu 16.04.3 LTS (Xenial Xerus)
    61 changes: 61 additions & 0 deletions cloud-config.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    #cloud-config
    apt:
    sources:
    kubernetes:
    source: "deb http://apt.kubernetes.io/ kubernetes-xenial main"
    # key from https://packages.cloud.google.com/apt/doc/apt-key.gpg
    key: |
    -----BEGIN PGP PUBLIC KEY BLOCK-----
    Version: GnuPG v1
    mQENBFUd6rIBCAD6mhKRHDn3UrCeLDp7U5IE7AhhrOCPpqGF7mfTemZYHf/5Jdjx
    cOxoSFlK7zwmFr3lVqJ+tJ9L1wd1K6P7RrtaNwCiZyeNPf/Y86AJ5NJwBe0VD0xH
    TXzPNTqRSByVYtdN94NoltXUYFAAPZYQls0x0nUD1hLMlOlC2HdTPrD1PMCnYq/N
    uL/Vk8sWrcUt4DIS+0RDQ8tKKe5PSV0+PnmaJvdF5CKawhh0qGTklS2MXTyKFoqj
    XgYDfY2EodI9ogT/LGr9Lm/+u4OFPvmN9VN6UG+s0DgJjWvpbmuHL/ZIRwMEn/tp
    uneaLTO7h1dCrXC849PiJ8wSkGzBnuJQUbXnABEBAAG0QEdvb2dsZSBDbG91ZCBQ
    YWNrYWdlcyBBdXRvbWF0aWMgU2lnbmluZyBLZXkgPGdjLXRlYW1AZ29vZ2xlLmNv
    bT6JAT4EEwECACgFAlUd6rICGy8FCQWjmoAGCwkIBwMCBhUIAgkKCwQWAgMBAh4B
    AheAAAoJEDdGwginMXsPcLcIAKi2yNhJMbu4zWQ2tM/rJFovazcY28MF2rDWGOnc
    9giHXOH0/BoMBcd8rw0lgjmOosBdM2JT0HWZIxC/Gdt7NSRA0WOlJe04u82/o3OH
    WDgTdm9MS42noSP0mvNzNALBbQnlZHU0kvt3sV1YsnrxljoIuvxKWLLwren/GVsh
    FLPwONjw3f9Fan6GWxJyn/dkX3OSUGaduzcygw51vksBQiUZLCD2Tlxyr9NvkZYT
    qiaWW78L6regvATsLc9L/dQUiSMQZIK6NglmHE+cuSaoK0H4ruNKeTiQUw/EGFaL
    ecay6Qy/s3Hk7K0QLd+gl0hZ1w1VzIeXLo2BRlqnjOYFX4A=
    =HVTm
    -----END PGP PUBLIC KEY BLOCK-----
    package_upgrade: true
    packages:
    - docker.io
    - kubelet
    - kubectl
    - kubeadm
    write_files:
    - path: /etc/cni/net.d/10-cni.json
    content: |
    {
    "cniVersion": "0.2.0",
    "name": "my-kubenet",
    "type": "bridge",
    "bridge": "cni0",
    "isGateway": true,
    "ipMasq": true,
    "ipam": {
    "type": "host-local",
    "subnet": "10.22.0.0/16",
    "routes": [
    { "dst": "0.0.0.0/0" }
    ]
    }
    }
    runcmd:
    - systemctl enable --now docker.service
    - usermod -a -G docker ubuntu
    - kubeadm init --skip-token-print
    - kubectl --kubeconfig /etc/kubernetes/admin.conf taint nodes --all node-role.kubernetes.io/master-
    - mkdir /home/ubuntu/.kube
    - cp /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
    - chown -R ubuntu:ubuntu /home/ubuntu/.kube
    power_state:
    timeout: 300
    mode: reboot