Skip to content

Commit 79a3f79

Browse files
Update to Kubernetes 1.21.0
1 parent ca96371 commit 79a3f79

12 files changed

+107
-94
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ The target audience for this tutorial is someone planning to support a productio
1919

2020
Kubernetes The Hard Way guides you through bootstrapping a highly available Kubernetes cluster with end-to-end encryption between components and RBAC authentication.
2121

22-
* [kubernetes](https://github.com/kubernetes/kubernetes) v1.18.6
23-
* [containerd](https://github.com/containerd/containerd) v1.3.6
24-
* [coredns](https://github.com/coredns/coredns) v1.7.0
25-
* [cni](https://github.com/containernetworking/cni) v0.8.6
26-
* [etcd](https://github.com/coreos/etcd) v3.4.10
22+
* [kubernetes](https://github.com/kubernetes/kubernetes) v1.21.0
23+
* [containerd](https://github.com/containerd/containerd) v1.4.4
24+
* [coredns](https://github.com/coredns/coredns) v1.8.3
25+
* [cni](https://github.com/containernetworking/cni) v0.9.1
26+
* [etcd](https://github.com/etcd-io/etcd) v3.4.15
2727

2828
## Labs
2929

docs/01-prerequisites.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This tutorial leverages the [Google Cloud Platform](https://cloud.google.com/) t
1414

1515
Follow the Google Cloud SDK [documentation](https://cloud.google.com/sdk/) to install and configure the `gcloud` command line utility.
1616

17-
Verify the Google Cloud SDK version is 301.0.0 or higher:
17+
Verify the Google Cloud SDK version is 338.0.0 or higher:
1818

1919
```
2020
gcloud version

docs/02-client-tools.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ The `kubectl` command line utility is used to interact with the Kubernetes API S
7676
### OS X
7777

7878
```
79-
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/darwin/amd64/kubectl
79+
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/darwin/amd64/kubectl
8080
```
8181

8282
```
@@ -90,7 +90,7 @@ sudo mv kubectl /usr/local/bin/
9090
### Linux
9191

9292
```
93-
wget https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kubectl
93+
wget https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl
9494
```
9595

9696
```
@@ -103,7 +103,7 @@ sudo mv kubectl /usr/local/bin/
103103

104104
### Verification
105105

106-
Verify `kubectl` version 1.18.6 or higher is installed:
106+
Verify `kubectl` version 1.21.0 or higher is installed:
107107

108108
```
109109
kubectl version --client
@@ -112,7 +112,7 @@ kubectl version --client
112112
> output
113113
114114
```
115-
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.6", GitCommit:"dff82dc0de47299ab66c83c626e08b245ab19037", GitTreeState:"clean", BuildDate:"2020-07-15T16:58:53Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
115+
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
116116
```
117117

118118
Next: [Provisioning Compute Resources](03-compute-resources.md)

docs/03-compute-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ Waiting for SSH key to propagate.
208208
After the SSH keys have been updated you'll be logged into the `controller-0` instance:
209209

210210
```
211-
Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-1019-gcp x86_64)
211+
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-1042-gcp x86_64)
212212
...
213213
```
214214

docs/07-bootstrapping-etcd.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Download the official etcd release binaries from the [etcd](https://github.com/e
2222

2323
```
2424
wget -q --show-progress --https-only --timestamping \
25-
"https://github.com/etcd-io/etcd/releases/download/v3.4.10/etcd-v3.4.10-linux-amd64.tar.gz"
25+
"https://github.com/etcd-io/etcd/releases/download/v3.4.15/etcd-v3.4.15-linux-amd64.tar.gz"
2626
```
2727

2828
Extract and install the `etcd` server and the `etcdctl` command line utility:
2929

3030
```
3131
{
32-
tar -xvf etcd-v3.4.10-linux-amd64.tar.gz
33-
sudo mv etcd-v3.4.10-linux-amd64/etcd* /usr/local/bin/
32+
tar -xvf etcd-v3.4.15-linux-amd64.tar.gz
33+
sudo mv etcd-v3.4.15-linux-amd64/etcd* /usr/local/bin/
3434
}
3535
```
3636

docs/08-bootstrapping-kubernetes-controllers.md

+30-21
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ Download the official Kubernetes release binaries:
2828

2929
```
3030
wget -q --show-progress --https-only --timestamping \
31-
"https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kube-apiserver" \
32-
"https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kube-controller-manager" \
33-
"https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kube-scheduler" \
34-
"https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kubectl"
31+
"https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kube-apiserver" \
32+
"https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kube-controller-manager" \
33+
"https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kube-scheduler" \
34+
"https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl"
3535
```
3636

3737
Install the Kubernetes binaries:
@@ -62,6 +62,17 @@ INTERNAL_IP=$(curl -s -H "Metadata-Flavor: Google" \
6262
http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/ip)
6363
```
6464

65+
```
66+
REGION=$(curl -s -H "Metadata-Flavor: Google" \
67+
http://metadata.google.internal/computeMetadata/v1/project/attributes/google-compute-default-region)
68+
```
69+
70+
```
71+
KUBERNETES_PUBLIC_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
72+
--region $REGION \
73+
--format 'value(address)')
74+
```
75+
6576
Create the `kube-apiserver.service` systemd unit file:
6677

6778
```
@@ -92,9 +103,10 @@ ExecStart=/usr/local/bin/kube-apiserver \\
92103
--kubelet-certificate-authority=/var/lib/kubernetes/ca.pem \\
93104
--kubelet-client-certificate=/var/lib/kubernetes/kubernetes.pem \\
94105
--kubelet-client-key=/var/lib/kubernetes/kubernetes-key.pem \\
95-
--kubelet-https=true \\
96106
--runtime-config='api/all=true' \\
97107
--service-account-key-file=/var/lib/kubernetes/service-account.pem \\
108+
--service-account-signing-key-file=/var/lib/kubernetes/service-account-key.pem \\
109+
--service-account-issuer=https://${KUBERNETES_PUBLIC_ADDRESS}:6443 \\
98110
--service-cluster-ip-range=10.32.0.0/24 \\
99111
--service-node-port-range=30000-32767 \\
100112
--tls-cert-file=/var/lib/kubernetes/kubernetes.pem \\
@@ -158,7 +170,7 @@ Create the `kube-scheduler.yaml` configuration file:
158170

159171
```
160172
cat <<EOF | sudo tee /etc/kubernetes/config/kube-scheduler.yaml
161-
apiVersion: kubescheduler.config.k8s.io/v1alpha1
173+
apiVersion: kubescheduler.config.k8s.io/v1beta1
162174
kind: KubeSchedulerConfiguration
163175
clientConnection:
164176
kubeconfig: "/var/lib/kubernetes/kube-scheduler.kubeconfig"
@@ -246,16 +258,11 @@ sudo systemctl enable nginx
246258
### Verification
247259

248260
```
249-
kubectl get componentstatuses --kubeconfig admin.kubeconfig
261+
kubectl cluster-info --kubeconfig admin.kubeconfig
250262
```
251263

252264
```
253-
NAME STATUS MESSAGE ERROR
254-
scheduler Healthy ok
255-
controller-manager Healthy ok
256-
etcd-0 Healthy {"health":"true"}
257-
etcd-1 Healthy {"health":"true"}
258-
etcd-2 Healthy {"health":"true"}
265+
Kubernetes control plane is running at https://127.0.0.1:6443
259266
```
260267

261268
Test the nginx HTTP health check proxy:
@@ -267,12 +274,14 @@ curl -H "Host: kubernetes.default.svc.cluster.local" -i http://127.0.0.1/healthz
267274
```
268275
HTTP/1.1 200 OK
269276
Server: nginx/1.18.0 (Ubuntu)
270-
Date: Sat, 18 Jul 2020 06:20:48 GMT
277+
Date: Sun, 02 May 2021 04:19:29 GMT
271278
Content-Type: text/plain; charset=utf-8
272279
Content-Length: 2
273280
Connection: keep-alive
274281
Cache-Control: no-cache, private
275282
X-Content-Type-Options: nosniff
283+
X-Kubernetes-Pf-Flowschema-Uid: c43f32eb-e038-457f-9474-571d43e5c325
284+
X-Kubernetes-Pf-Prioritylevel-Uid: 8ba5908f-5569-4330-80fd-c643e7512366
276285
277286
ok
278287
```
@@ -295,7 +304,7 @@ Create the `system:kube-apiserver-to-kubelet` [ClusterRole](https://kubernetes.i
295304

296305
```
297306
cat <<EOF | kubectl apply --kubeconfig admin.kubeconfig -f -
298-
apiVersion: rbac.authorization.k8s.io/v1beta1
307+
apiVersion: rbac.authorization.k8s.io/v1
299308
kind: ClusterRole
300309
metadata:
301310
annotations:
@@ -323,7 +332,7 @@ Bind the `system:kube-apiserver-to-kubelet` ClusterRole to the `kubernetes` user
323332

324333
```
325334
cat <<EOF | kubectl apply --kubeconfig admin.kubeconfig -f -
326-
apiVersion: rbac.authorization.k8s.io/v1beta1
335+
apiVersion: rbac.authorization.k8s.io/v1
327336
kind: ClusterRoleBinding
328337
metadata:
329338
name: system:kube-apiserver
@@ -403,12 +412,12 @@ curl --cacert ca.pem https://${KUBERNETES_PUBLIC_ADDRESS}:6443/version
403412
```
404413
{
405414
"major": "1",
406-
"minor": "18",
407-
"gitVersion": "v1.18.6",
408-
"gitCommit": "dff82dc0de47299ab66c83c626e08b245ab19037",
415+
"minor": "21",
416+
"gitVersion": "v1.21.0",
417+
"gitCommit": "cb303e613a121a29364f75cc67d3d580833a7479",
409418
"gitTreeState": "clean",
410-
"buildDate": "2020-07-15T16:51:04Z",
411-
"goVersion": "go1.13.9",
419+
"buildDate": "2021-04-08T16:25:06Z",
420+
"goVersion": "go1.16.1",
412421
"compiler": "gc",
413422
"platform": "linux/amd64"
414423
}

docs/09-bootstrapping-kubernetes-workers.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ sudo swapoff -a
4949

5050
```
5151
wget -q --show-progress --https-only --timestamping \
52-
https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.18.0/crictl-v1.18.0-linux-amd64.tar.gz \
53-
https://github.com/opencontainers/runc/releases/download/v1.0.0-rc91/runc.amd64 \
54-
https://github.com/containernetworking/plugins/releases/download/v0.8.6/cni-plugins-linux-amd64-v0.8.6.tgz \
55-
https://github.com/containerd/containerd/releases/download/v1.3.6/containerd-1.3.6-linux-amd64.tar.gz \
56-
https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kubectl \
57-
https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kube-proxy \
58-
https://storage.googleapis.com/kubernetes-release/release/v1.18.6/bin/linux/amd64/kubelet
52+
https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.21.0/crictl-v1.21.0-linux-amd64.tar.gz \
53+
https://github.com/opencontainers/runc/releases/download/v1.0.0-rc93/runc.amd64 \
54+
https://github.com/containernetworking/plugins/releases/download/v0.9.1/cni-plugins-linux-amd64-v0.9.1.tgz \
55+
https://github.com/containerd/containerd/releases/download/v1.4.4/containerd-1.4.4-linux-amd64.tar.gz \
56+
https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl \
57+
https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kube-proxy \
58+
https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubelet
5959
```
6060

6161
Create the installation directories:
@@ -75,9 +75,9 @@ Install the worker binaries:
7575
```
7676
{
7777
mkdir containerd
78-
tar -xvf crictl-v1.18.0-linux-amd64.tar.gz
79-
tar -xvf containerd-1.3.6-linux-amd64.tar.gz -C containerd
80-
sudo tar -xvf cni-plugins-linux-amd64-v0.8.6.tgz -C /opt/cni/bin/
78+
tar -xvf crictl-v1.21.0-linux-amd64.tar.gz
79+
tar -xvf containerd-1.4.4-linux-amd64.tar.gz -C containerd
80+
sudo tar -xvf cni-plugins-linux-amd64-v0.9.1.tgz -C /opt/cni/bin/
8181
sudo mv runc.amd64 runc
8282
chmod +x crictl kubectl kube-proxy kubelet runc
8383
sudo mv crictl kubectl kube-proxy kubelet runc /usr/local/bin/
@@ -99,7 +99,7 @@ Create the `bridge` network configuration file:
9999
```
100100
cat <<EOF | sudo tee /etc/cni/net.d/10-bridge.conf
101101
{
102-
"cniVersion": "0.3.1",
102+
"cniVersion": "0.4.0",
103103
"name": "bridge",
104104
"type": "bridge",
105105
"bridge": "cnio0",
@@ -121,7 +121,7 @@ Create the `loopback` network configuration file:
121121
```
122122
cat <<EOF | sudo tee /etc/cni/net.d/99-loopback.conf
123123
{
124-
"cniVersion": "0.3.1",
124+
"cniVersion": "0.4.0",
125125
"name": "lo",
126126
"type": "loopback"
127127
}
@@ -305,9 +305,9 @@ gcloud compute ssh controller-0 \
305305
306306
```
307307
NAME STATUS ROLES AGE VERSION
308-
worker-0 Ready <none> 24s v1.18.6
309-
worker-1 Ready <none> 24s v1.18.6
310-
worker-2 Ready <none> 24s v1.18.6
308+
worker-0 Ready <none> 22s v1.21.0
309+
worker-1 Ready <none> 22s v1.21.0
310+
worker-2 Ready <none> 22s v1.21.0
311311
```
312312

313313
Next: [Configuring kubectl for Remote Access](10-configuring-kubectl.md)

docs/10-configuring-kubectl.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,17 @@ Generate a kubeconfig file suitable for authenticating as the `admin` user:
3535

3636
## Verification
3737

38-
Check the health of the remote Kubernetes cluster:
38+
Check the version of the remote Kubernetes cluster:
3939

4040
```
41-
kubectl get componentstatuses
41+
kubectl version
4242
```
4343

4444
> output
4545
4646
```
47-
NAME STATUS MESSAGE ERROR
48-
scheduler Healthy ok
49-
controller-manager Healthy ok
50-
etcd-0 Healthy {"health":"true"}
51-
etcd-1 Healthy {"health":"true"}
52-
etcd-2 Healthy {"health":"true"}
47+
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
48+
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:25:06Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
5349
```
5450

5551
List the nodes in the remote Kubernetes cluster:
@@ -62,9 +58,9 @@ kubectl get nodes
6258
6359
```
6460
NAME STATUS ROLES AGE VERSION
65-
worker-0 Ready <none> 2m30s v1.18.6
66-
worker-1 Ready <none> 2m30s v1.18.6
67-
worker-2 Ready <none> 2m30s v1.18.6
61+
worker-0 Ready <none> 2m35s v1.21.0
62+
worker-1 Ready <none> 2m35s v1.21.0
63+
worker-2 Ready <none> 2m35s v1.21.0
6864
```
6965

7066
Next: [Provisioning Pod Network Routes](11-pod-network-routes.md)

docs/11-pod-network-routes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ gcloud compute routes list --filter "network: kubernetes-the-hard-way"
5050
5151
```
5252
NAME NETWORK DEST_RANGE NEXT_HOP PRIORITY
53-
default-route-6be823b741087623 kubernetes-the-hard-way 0.0.0.0/0 default-internet-gateway 1000
54-
default-route-cebc434ce276fafa kubernetes-the-hard-way 10.240.0.0/24 kubernetes-the-hard-way 0
53+
default-route-1606ba68df692422 kubernetes-the-hard-way 10.240.0.0/24 kubernetes-the-hard-way 0
54+
default-route-615e3652a8b74e4d kubernetes-the-hard-way 0.0.0.0/0 default-internet-gateway 1000
5555
kubernetes-route-10-200-0-0-24 kubernetes-the-hard-way 10.200.0.0/24 10.240.0.20 1000
5656
kubernetes-route-10-200-1-0-24 kubernetes-the-hard-way 10.200.1.0/24 10.240.0.21 1000
5757
kubernetes-route-10-200-2-0-24 kubernetes-the-hard-way 10.200.2.0/24 10.240.0.22 1000

docs/12-dns-addon.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ In this lab you will deploy the [DNS add-on](https://kubernetes.io/docs/concepts
77
Deploy the `coredns` cluster add-on:
88

99
```
10-
kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.7.0.yaml
10+
kubectl apply -f https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.8.yaml
1111
```
1212

1313
> output
@@ -31,8 +31,8 @@ kubectl get pods -l k8s-app=kube-dns -n kube-system
3131
3232
```
3333
NAME READY STATUS RESTARTS AGE
34-
coredns-5677dc4cdb-d8rtv 1/1 Running 0 30s
35-
coredns-5677dc4cdb-m8n69 1/1 Running 0 30s
34+
coredns-8494f9c688-hh7r2 1/1 Running 0 10s
35+
coredns-8494f9c688-zqrj2 1/1 Running 0 10s
3636
```
3737

3838
## Verification

0 commit comments

Comments
 (0)