Skip to content

Commit 5c46222

Browse files
Update to Kubernetes 1.15.3
1 parent bf28509 commit 5c46222

16 files changed

+336
-233
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ service-account-key.pem
4747
service-account.csr
4848
service-account.pem
4949
service-account-csr.json
50+
*.swp

COPYRIGHT.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Copyright
2+
3+
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# Kubernetes The Hard Way
22

3-
This tutorial walks you through setting up Kubernetes the hard way. This guide is not for people looking for a fully automated command to bring up a Kubernetes cluster. If that's you then check out [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine), or the [Getting Started Guides](http://kubernetes.io/docs/getting-started-guides/).
3+
This tutorial walks you through setting up Kubernetes the hard way. This guide is not for people looking for a fully automated command to bring up a Kubernetes cluster. If that's you then check out [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine), or the [Getting Started Guides](https://kubernetes.io/docs/setup).
44

55
Kubernetes The Hard Way is optimized for learning, which means taking the long route to ensure you understand each task required to bootstrap a Kubernetes cluster.
66

77
> The results of this tutorial should not be viewed as production ready, and may receive limited support from the community, but don't let that stop you from learning!
88
9+
## Copyright
10+
11+
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.
12+
13+
914
## Target Audience
1015

1116
The target audience for this tutorial is someone planning to support a production Kubernetes cluster and wants to understand how everything fits together.
@@ -14,12 +19,11 @@ The target audience for this tutorial is someone planning to support a productio
1419

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

17-
* [Kubernetes](https://github.com/kubernetes/kubernetes) 1.12.0
18-
* [containerd Container Runtime](https://github.com/containerd/containerd) 1.2.0-rc.0
19-
* [gVisor](https://github.com/google/gvisor) 50c283b9f56bb7200938d9e207355f05f79f0d17
20-
* [CNI Container Networking](https://github.com/containernetworking/cni) 0.6.0
21-
* [etcd](https://github.com/coreos/etcd) v3.3.9
22-
* [CoreDNS](https://github.com/coredns/coredns) v1.2.2
22+
* [kubernetes](https://github.com/kubernetes/kubernetes) 1.15.3
23+
* [containerd](https://github.com/containerd/containerd) 1.2.9
24+
* [coredns](https://github.com/coredns/coredns) v1.6.3
25+
* [cni](https://github.com/containernetworking/cni) v0.7.1
26+
* [etcd](https://github.com/coreos/etcd) v3.4.0
2327

2428
## Labs
2529

deployments/coredns.yaml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: coredns
5+
namespace: kube-system
6+
---
7+
apiVersion: rbac.authorization.k8s.io/v1
8+
kind: ClusterRole
9+
metadata:
10+
labels:
11+
kubernetes.io/bootstrapping: rbac-defaults
12+
name: system:coredns
13+
rules:
14+
- apiGroups:
15+
- ""
16+
resources:
17+
- endpoints
18+
- services
19+
- pods
20+
- namespaces
21+
verbs:
22+
- list
23+
- watch
24+
- apiGroups:
25+
- ""
26+
resources:
27+
- nodes
28+
verbs:
29+
- get
30+
---
31+
apiVersion: rbac.authorization.k8s.io/v1
32+
kind: ClusterRoleBinding
33+
metadata:
34+
annotations:
35+
rbac.authorization.kubernetes.io/autoupdate: "true"
36+
labels:
37+
kubernetes.io/bootstrapping: rbac-defaults
38+
name: system:coredns
39+
roleRef:
40+
apiGroup: rbac.authorization.k8s.io
41+
kind: ClusterRole
42+
name: system:coredns
43+
subjects:
44+
- kind: ServiceAccount
45+
name: coredns
46+
namespace: kube-system
47+
---
48+
apiVersion: v1
49+
kind: ConfigMap
50+
metadata:
51+
name: coredns
52+
namespace: kube-system
53+
data:
54+
Corefile: |
55+
.:53 {
56+
errors
57+
health
58+
ready
59+
kubernetes cluster.local in-addr.arpa ip6.arpa {
60+
pods insecure
61+
fallthrough in-addr.arpa ip6.arpa
62+
}
63+
prometheus :9153
64+
cache 30
65+
loop
66+
reload
67+
loadbalance
68+
}
69+
---
70+
apiVersion: apps/v1
71+
kind: Deployment
72+
metadata:
73+
name: coredns
74+
namespace: kube-system
75+
labels:
76+
k8s-app: kube-dns
77+
kubernetes.io/name: "CoreDNS"
78+
spec:
79+
replicas: 2
80+
strategy:
81+
type: RollingUpdate
82+
rollingUpdate:
83+
maxUnavailable: 1
84+
selector:
85+
matchLabels:
86+
k8s-app: kube-dns
87+
template:
88+
metadata:
89+
labels:
90+
k8s-app: kube-dns
91+
spec:
92+
priorityClassName: system-cluster-critical
93+
serviceAccountName: coredns
94+
tolerations:
95+
- key: "CriticalAddonsOnly"
96+
operator: "Exists"
97+
nodeSelector:
98+
beta.kubernetes.io/os: linux
99+
containers:
100+
- name: coredns
101+
image: coredns/coredns:1.6.2
102+
imagePullPolicy: IfNotPresent
103+
resources:
104+
limits:
105+
memory: 170Mi
106+
requests:
107+
cpu: 100m
108+
memory: 70Mi
109+
args: [ "-conf", "/etc/coredns/Corefile" ]
110+
volumeMounts:
111+
- name: config-volume
112+
mountPath: /etc/coredns
113+
readOnly: true
114+
ports:
115+
- containerPort: 53
116+
name: dns
117+
protocol: UDP
118+
- containerPort: 53
119+
name: dns-tcp
120+
protocol: TCP
121+
- containerPort: 9153
122+
name: metrics
123+
protocol: TCP
124+
securityContext:
125+
allowPrivilegeEscalation: false
126+
capabilities:
127+
add:
128+
- NET_BIND_SERVICE
129+
drop:
130+
- all
131+
readOnlyRootFilesystem: true
132+
livenessProbe:
133+
httpGet:
134+
path: /health
135+
port: 8080
136+
scheme: HTTP
137+
initialDelaySeconds: 60
138+
timeoutSeconds: 5
139+
successThreshold: 1
140+
failureThreshold: 5
141+
readinessProbe:
142+
httpGet:
143+
path: /ready
144+
port: 8181
145+
scheme: HTTP
146+
dnsPolicy: Default
147+
volumes:
148+
- name: config-volume
149+
configMap:
150+
name: coredns
151+
items:
152+
- key: Corefile
153+
path: Corefile
154+
---
155+
apiVersion: v1
156+
kind: Service
157+
metadata:
158+
name: kube-dns
159+
namespace: kube-system
160+
annotations:
161+
prometheus.io/port: "9153"
162+
prometheus.io/scrape: "true"
163+
labels:
164+
k8s-app: kube-dns
165+
kubernetes.io/cluster-service: "true"
166+
kubernetes.io/name: "CoreDNS"
167+
spec:
168+
selector:
169+
k8s-app: kube-dns
170+
clusterIP: 10.32.0.10
171+
ports:
172+
- name: dns
173+
port: 53
174+
protocol: UDP
175+
- name: dns-tcp
176+
port: 53
177+
protocol: TCP
178+
- name: metrics
179+
port: 9153
180+
protocol: TCP

docs/01-prerequisites.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This tutorial leverages the [Google Cloud Platform](https://cloud.google.com/) to streamline provisioning of the compute infrastructure required to bootstrap a Kubernetes cluster from the ground up. [Sign up](https://cloud.google.com/free/) for $300 in free credits.
66

7-
[Estimated cost](https://cloud.google.com/products/calculator/#id=78df6ced-9c50-48f8-a670-bc5003f2ddaa) to run this tutorial: $0.22 per hour ($5.39 per day).
7+
[Estimated cost](https://cloud.google.com/products/calculator/#id=55663256-c384-449c-9306-e39893e23afb) to run this tutorial: $0.23 per hour ($5.46 per day).
88

99
> The compute resources required for this tutorial exceed the Google Cloud Platform free tier.
1010
@@ -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 218.0.0 or higher:
17+
Verify the Google Cloud SDK version is 262.0.0 or higher:
1818

1919
```
2020
gcloud version
@@ -30,7 +30,13 @@ If you are using the `gcloud` command-line tool for the first time `init` is the
3030
gcloud init
3131
```
3232

33-
Otherwise set a default compute region:
33+
Then be sure to authorize gcloud to access the Cloud Platform with your Google user credentials:
34+
35+
```
36+
gcloud auth login
37+
```
38+
39+
Next set a default compute region and compute zone:
3440

3541
```
3642
gcloud config set compute/region us-west1
@@ -46,12 +52,12 @@ gcloud config set compute/zone us-west1-c
4652
4753
## Running Commands in Parallel with tmux
4854

49-
[tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. Labs in this tutorial may require running the same commands across multiple compute instances, in those cases consider using tmux and splitting a window into multiple panes with `synchronize-panes` enabled to speed up the provisioning process.
55+
[tmux](https://github.com/tmux/tmux/wiki) can be used to run commands on multiple compute instances at the same time. Labs in this tutorial may require running the same commands across multiple compute instances, in those cases consider using tmux and splitting a window into multiple panes with synchronize-panes enabled to speed up the provisioning process.
5056

5157
> The use of tmux is optional and not required to complete this tutorial.
5258
5359
![tmux screenshot](images/tmux-screenshot.png)
5460

55-
> Enable `synchronize-panes`: `ctrl+b` then `shift :`. Then type `set synchronize-panes on` at the prompt. To disable synchronization: `set synchronize-panes off`.
61+
> Enable synchronize-panes by pressing `ctrl+b` followed by `shift+:`. Next type `set synchronize-panes on` at the prompt. To disable synchronization: `set synchronize-panes off`.
5662
5763
Next: [Installing the Client Tools](02-client-tools.md)

docs/02-client-tools.md

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ In this lab you will install the command line utilities required to complete thi
77

88
The `cfssl` and `cfssljson` command line utilities will be used to provision a [PKI Infrastructure](https://en.wikipedia.org/wiki/Public_key_infrastructure) and generate TLS certificates.
99

10-
Download and install `cfssl` and `cfssljson` from the [cfssl repository](https://pkg.cfssl.org):
10+
Download and install `cfssl` and `cfssljson`:
1111

1212
### OS X
1313

1414
```
15-
curl -o cfssl https://pkg.cfssl.org/R1.2/cfssl_darwin-amd64
16-
curl -o cfssljson https://pkg.cfssl.org/R1.2/cfssljson_darwin-amd64
15+
curl -o cfssl https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/darwin/cfssl
16+
curl -o cfssljson https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/darwin/cfssljson
1717
```
1818

1919
```
@@ -34,25 +34,21 @@ brew install cfssl
3434

3535
```
3636
wget -q --show-progress --https-only --timestamping \
37-
https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 \
38-
https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
37+
https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/linux/cfssl \
38+
https://storage.googleapis.com/kubernetes-the-hard-way/cfssl/linux/cfssljson
3939
```
4040

4141
```
42-
chmod +x cfssl_linux-amd64 cfssljson_linux-amd64
43-
```
44-
45-
```
46-
sudo mv cfssl_linux-amd64 /usr/local/bin/cfssl
42+
chmod +x cfssl cfssljson
4743
```
4844

4945
```
50-
sudo mv cfssljson_linux-amd64 /usr/local/bin/cfssljson
46+
sudo mv cfssl cfssljson /usr/local/bin/
5147
```
5248

5349
### Verification
5450

55-
Verify `cfssl` version 1.2.0 or higher is installed:
51+
Verify `cfssl` and `cfssljson` version 1.3.4 or higher is installed:
5652

5753
```
5854
cfssl version
@@ -61,12 +57,19 @@ cfssl version
6157
> output
6258
6359
```
64-
Version: 1.2.0
60+
Version: 1.3.4
6561
Revision: dev
66-
Runtime: go1.6
62+
Runtime: go1.13
6763
```
6864

69-
> The cfssljson command line utility does not provide a way to print its version.
65+
```
66+
cfssljson --version
67+
```
68+
```
69+
Version: 1.3.4
70+
Revision: dev
71+
Runtime: go1.13
72+
```
7073

7174
## Install kubectl
7275

@@ -75,7 +78,7 @@ The `kubectl` command line utility is used to interact with the Kubernetes API S
7578
### OS X
7679

7780
```
78-
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/darwin/amd64/kubectl
81+
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/darwin/amd64/kubectl
7982
```
8083

8184
```
@@ -89,7 +92,7 @@ sudo mv kubectl /usr/local/bin/
8992
### Linux
9093

9194
```
92-
wget https://storage.googleapis.com/kubernetes-release/release/v1.12.0/bin/linux/amd64/kubectl
95+
wget https://storage.googleapis.com/kubernetes-release/release/v1.15.3/bin/linux/amd64/kubectl
9396
```
9497

9598
```
@@ -102,7 +105,7 @@ sudo mv kubectl /usr/local/bin/
102105

103106
### Verification
104107

105-
Verify `kubectl` version 1.12.0 or higher is installed:
108+
Verify `kubectl` version 1.15.3 or higher is installed:
106109

107110
```
108111
kubectl version --client
@@ -111,7 +114,7 @@ kubectl version --client
111114
> output
112115
113116
```
114-
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"clean", BuildDate:"2018-09-27T17:05:32Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
117+
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:54Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
115118
```
116119

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

0 commit comments

Comments
 (0)