diff --git a/docs/09-bootstrapping-kubernetes-workers.md b/docs/09-bootstrapping-kubernetes-workers.md index bec4960..5649ebf 100644 --- a/docs/09-bootstrapping-kubernetes-workers.md +++ b/docs/09-bootstrapping-kubernetes-workers.md @@ -2,24 +2,27 @@ In this lab you will bootstrap three Kubernetes worker nodes. The following components will be installed on each node: [runc](https://github.com/opencontainers/runc), [gVisor](https://github.com/google/gvisor), [container networking plugins](https://github.com/containernetworking/cni), [containerd](https://github.com/containerd/containerd), [kubelet](https://kubernetes.io/docs/admin/kubelet), and [kube-proxy](https://kubernetes.io/docs/concepts/cluster-administration/proxies). + ## Prerequisites -The commands in this lab must be run on each worker instance: `worker-0`, `worker-1`, and `worker-2`. Login to each worker instance using the `gcloud` command. Example: +The commands in this lab must be run on each worker instance: `worker-1`, `worker-2`, and `worker-3`. Login to each worker instance: ``` -gcloud compute ssh worker-0 +$ ssh -i ~/.ssh/id_rsa-k8s.pub 10.240.0.21 ``` + ### Running commands in parallel with tmux [tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. See the [Running commands in parallel with tmux](01-prerequisites.md#running-commands-in-parallel-with-tmux) section in the Prerequisites lab. + ## Provisioning a Kubernetes Worker Node Install the OS dependencies: ``` -{ +$ { sudo apt-get update sudo apt-get -y install socat conntrack ipset } @@ -30,7 +33,7 @@ Install the OS dependencies: ### Download and Install Worker Binaries ``` -wget -q --show-progress --https-only --timestamping \ +$ wget -q --show-progress --https-only --timestamping \ https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.12.0/crictl-v1.12.0-linux-amd64.tar.gz \ https://storage.googleapis.com/kubernetes-the-hard-way/runsc-50c283b9f56bb7200938d9e207355f05f79f0d17 \ https://github.com/opencontainers/runc/releases/download/v1.0.0-rc5/runc.amd64 \ @@ -44,7 +47,7 @@ wget -q --show-progress --https-only --timestamping \ Create the installation directories: ``` -sudo mkdir -p \ +$ sudo mkdir -p \ /etc/cni/net.d \ /opt/cni/bin \ /var/lib/kubelet \ @@ -56,7 +59,7 @@ sudo mkdir -p \ Install the worker binaries: ``` -{ +$ { sudo mv runsc-50c283b9f56bb7200938d9e207355f05f79f0d17 runsc sudo mv runc.amd64 runc chmod +x kubectl kube-proxy kubelet runc runsc @@ -72,14 +75,13 @@ Install the worker binaries: Retrieve the Pod CIDR range for the current compute instance: ``` -POD_CIDR=$(curl -s -H "Metadata-Flavor: Google" \ - http://metadata.google.internal/computeMetadata/v1/instance/attributes/pod-cidr) +$ POD_CIDR=10.200.$(uname -n | awk -F"-" '{print $2}').0/24 ``` Create the `bridge` network configuration file: ``` -cat < The `resolvConf` configuration is used to avoid loops when using CoreDNS for service discovery on systems running `systemd-resolved`. +> The `resolvConf` configuration is used to avoid loops when using CoreDNS for service discovery on systems running `systemd-resolved`. Create the `kubelet.service` systemd unit file: ``` -cat < Remember to run the above commands on each worker node: `worker-0`, `worker-1`, and `worker-2`. +> Remember to run the above commands on each worker node: `worker-1`, `worker-2`, and `worker-3`. + ## Verification -> The compute instances created in this tutorial will not have permission to complete this section. Run the following commands from the same machine used to create the compute instances. +> The virtual machines created in this tutorial will not have permission to complete this section. Run the following commands from the same machine used to create the compute instances. List the registered Kubernetes nodes: ``` -gcloud compute ssh controller-0 \ - --command "kubectl get nodes --kubeconfig admin.kubeconfig" +$ ssh -i ~/.ssh/id_rsa-k8s.pub 10.240.0.11 "kubectl get nodes --kubeconfig admin.kubeconfig" ``` > output ``` NAME STATUS ROLES AGE VERSION -worker-0 Ready 35s v1.12.0 -worker-1 Ready 36s v1.12.0 +worker-1 Ready 35s v1.12.0 worker-2 Ready 36s v1.12.0 +worker-3 Ready 36s v1.12.0 ``` Next: [Configuring kubectl for Remote Access](10-configuring-kubectl.md)