Skip to content

Commit ede3437

Browse files
update to kubernetes 1.8
1 parent 7f7fd71 commit ede3437

11 files changed

+163
-126
lines changed

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
admin-csr.json
2+
admin-key.pem
3+
admin.csr
4+
admin.pem
5+
ca-config.json
6+
ca-csr.json
7+
ca-key.pem
8+
ca.csr
9+
ca.pem
10+
encryption-config.yaml
11+
kube-proxy-csr.json
12+
kube-proxy-key.pem
13+
kube-proxy.csr
14+
kube-proxy.kubeconfig
15+
kube-proxy.pem
16+
kubernetes-csr.json
17+
kubernetes-key.pem
18+
kubernetes.csr
19+
kubernetes.pem
20+
worker-0-csr.json
21+
worker-0-key.pem
22+
worker-0.csr
23+
worker-0.kubeconfig
24+
worker-0.pem
25+
worker-1-csr.json
26+
worker-1-key.pem
27+
worker-1.csr
28+
worker-1.kubeconfig
29+
worker-1.pem
30+
worker-2-csr.json
31+
worker-2-key.pem
32+
worker-2.csr
33+
worker-2.kubeconfig
34+
worker-2.pem

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ The target audience for this tutorial is someone planning to support a productio
1414

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

17-
* [Kubernetes](https://github.com/kubernetes/kubernetes) 1.7.4
18-
* [CRI-O Container Runtime](https://github.com/kubernetes-incubator/cri-o) v1.0.0-beta.0
19-
* [CNI Container Networking](https://github.com/containernetworking/cni) v0.6.0
20-
* [etcd](https://github.com/coreos/etcd) 3.2.6
17+
* [Kubernetes](https://github.com/kubernetes/kubernetes) 1.8.0
18+
* [cri-containerd Container Runtime](https://github.com/kubernetes-incubator/cri-containerd) 1.0.0-alpha.0
19+
* [CNI Container Networking](https://github.com/containernetworking/cni) 0.6.0
20+
* [etcd](https://github.com/coreos/etcd) 3.2.8
2121

2222
## Labs
2323

docs/01-prerequisites.md

Lines changed: 1 addition & 1 deletion
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 169.0.0 or higher:
17+
Verify the Google Cloud SDK version is 173.0.0 or higher:
1818

1919
```
2020
gcloud version

docs/02-client-tools.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The `kubectl` command line utility is used to interact with the Kubernetes API S
6969
### OS X
7070

7171
```
72-
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/darwin/amd64/kubectl
72+
curl -o kubectl https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/darwin/amd64/kubectl
7373
```
7474

7575
```
@@ -83,7 +83,7 @@ sudo mv kubectl /usr/local/bin/
8383
### Linux
8484

8585
```
86-
wget https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl
86+
wget https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl
8787
```
8888

8989
```
@@ -96,7 +96,7 @@ sudo mv kubectl /usr/local/bin/
9696

9797
### Verification
9898

99-
Verify `kubectl` version 1.7.4 or higher is installed:
99+
Verify `kubectl` version 1.8.0 or higher is installed:
100100

101101
```
102102
kubectl version --client
@@ -105,7 +105,7 @@ kubectl version --client
105105
> output
106106
107107
```
108-
Client Version: version.Info{Major:"1", Minor:"7", GitVersion:"v1.7.4", GitCommit:"793658f2d7ca7f064d2bdf606519f9fe1229c381", GitTreeState:"clean", BuildDate:"2017-08-17T08:48:23Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
108+
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
109109
```
110110

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

docs/03-compute-resources.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ gcloud compute firewall-rules create kubernetes-the-hard-way-allow-health-checks
6666
List the firewall rules in the `kubernetes-the-hard-way` VPC network:
6767

6868
```
69-
gcloud compute firewall-rules list --filter "network kubernetes-the-hard-way"
69+
gcloud compute firewall-rules list --filter "network: kubernetes-the-hard-way"
7070
```
7171

7272
> output
@@ -102,7 +102,7 @@ kubernetes-the-hard-way us-west1 XX.XXX.XXX.XX RESERVED
102102

103103
## Compute Instances
104104

105-
The compute instances in this lab will be provisioned using [Ubuntu Server](https://www.ubuntu.com/server) 16.04, which has good support for the [CRI-O container runtime](https://github.com/kubernetes-incubator/cri-o). Each compute instance will be provisioned with a fixed private IP address to simplify the Kubernetes bootstrapping process.
105+
The compute instances in this lab will be provisioned using [Ubuntu Server](https://www.ubuntu.com/server) 16.04, which has good support for the [cri-containerd container runtime](https://github.com/kubernetes-incubator/cri-containerd). Each compute instance will be provisioned with a fixed private IP address to simplify the Kubernetes bootstrapping process.
106106

107107
### Kubernetes Controllers
108108

@@ -146,7 +146,7 @@ for i in 0 1 2; do
146146
--scopes compute-rw,storage-ro,service-management,service-control,logging-write,monitoring \
147147
--subnet kubernetes \
148148
--tags kubernetes-the-hard-way,worker
149-
done
149+
done
150150
```
151151

152152
### Verification

docs/07-bootstrapping-etcd.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ Download the official etcd release binaries from the [coreos/etcd](https://githu
1818

1919
```
2020
wget -q --show-progress --https-only --timestamping \
21-
"https://github.com/coreos/etcd/releases/download/v3.2.6/etcd-v3.2.6-linux-amd64.tar.gz"
21+
"https://github.com/coreos/etcd/releases/download/v3.2.8/etcd-v3.2.8-linux-amd64.tar.gz"
2222
```
2323

2424
Extract and install the `etcd` server and the `etcdctl` command line utility:
2525

2626
```
27-
tar -xvf etcd-v3.2.6-linux-amd64.tar.gz
27+
tar -xvf etcd-v3.2.8-linux-amd64.tar.gz
2828
```
2929

3030
```
31-
sudo mv etcd-v3.2.6-linux-amd64/etcd* /usr/local/bin/
31+
sudo mv etcd-v3.2.8-linux-amd64/etcd* /usr/local/bin/
3232
```
3333

3434
### Configure the etcd Server

docs/08-bootstrapping-kubernetes-controllers.md

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Download the official Kubernetes release binaries:
1818

1919
```
2020
wget -q --show-progress --https-only --timestamping \
21-
"https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kube-apiserver" \
22-
"https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kube-controller-manager" \
23-
"https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kube-scheduler" \
24-
"https://storage.googleapis.com/kubernetes-release/release/v1.7.4/bin/linux/amd64/kubectl"
21+
"https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kube-apiserver" \
22+
"https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kube-controller-manager" \
23+
"https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kube-scheduler" \
24+
"https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl"
2525
```
2626

2727
Install the Kubernetes binaries:
@@ -61,7 +61,7 @@ Documentation=https://github.com/GoogleCloudPlatform/kubernetes
6161
6262
[Service]
6363
ExecStart=/usr/local/bin/kube-apiserver \\
64-
--admission-control=NamespaceLifecycle,NodeRestriction,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota \\
64+
--admission-control=Initializers,NamespaceLifecycle,NodeRestriction,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota \\
6565
--advertise-address=${INTERNAL_IP} \\
6666
--allow-privileged=true \\
6767
--apiserver-count=3 \\
@@ -79,12 +79,12 @@ ExecStart=/usr/local/bin/kube-apiserver \\
7979
--etcd-servers=https://10.240.0.10:2379,https://10.240.0.11:2379,https://10.240.0.12:2379 \\
8080
--event-ttl=1h \\
8181
--experimental-encryption-provider-config=/var/lib/kubernetes/encryption-config.yaml \\
82-
--insecure-bind-address=0.0.0.0 \\
82+
--insecure-bind-address=127.0.0.1 \\
8383
--kubelet-certificate-authority=/var/lib/kubernetes/ca.pem \\
8484
--kubelet-client-certificate=/var/lib/kubernetes/kubernetes.pem \\
8585
--kubelet-client-key=/var/lib/kubernetes/kubernetes-key.pem \\
8686
--kubelet-https=true \\
87-
--runtime-config=rbac.authorization.k8s.io/v1alpha1 \\
87+
--runtime-config=api/all \\
8888
--service-account-key-file=/var/lib/kubernetes/ca-key.pem \\
8989
--service-cluster-ip-range=10.32.0.0/24 \\
9090
--service-node-port-range=30000-32767 \\
@@ -118,7 +118,7 @@ ExecStart=/usr/local/bin/kube-controller-manager \\
118118
--cluster-signing-cert-file=/var/lib/kubernetes/ca.pem \\
119119
--cluster-signing-key-file=/var/lib/kubernetes/ca-key.pem \\
120120
--leader-elect=true \\
121-
--master=http://${INTERNAL_IP}:8080 \\
121+
--master=http://127.0.0.1:8080 \\
122122
--root-ca-file=/var/lib/kubernetes/ca.pem \\
123123
--service-account-private-key-file=/var/lib/kubernetes/ca-key.pem \\
124124
--service-cluster-ip-range=10.32.0.0/24 \\
@@ -144,7 +144,7 @@ Documentation=https://github.com/GoogleCloudPlatform/kubernetes
144144
[Service]
145145
ExecStart=/usr/local/bin/kube-scheduler \\
146146
--leader-elect=true \\
147-
--master=http://${INTERNAL_IP}:8080 \\
147+
--master=http://127.0.0.1:8080 \\
148148
--v=2
149149
Restart=on-failure
150150
RestartSec=5
@@ -191,6 +191,64 @@ etcd-1 Healthy {"health": "true"}
191191

192192
> Remember to run the above commands on each controller node: `controller-0`, `controller-1`, and `controller-2`.
193193
194+
## RBAC for Kubelet Authorization
195+
196+
In this section you will configure RBAC permissions to allow the Kubernetes API Server to access the Kubelet API on each worker node. Access to the Kubelet API is required for retrieving metrics, logs, and executing commands in pods.
197+
198+
> This tutorial sets the Kubelet `--authorization-mode` flag to `Webhook`. Webhook mode uses the [SubjectAccessReview](https://kubernetes.io/docs/admin/authorization/#checking-api-access) API to determine authorization.
199+
200+
```
201+
gcloud compute ssh controller-0
202+
```
203+
204+
Create the `system:kube-apiserver-to-kubelet` [ClusterRole](https://kubernetes.io/docs/admin/authorization/rbac/#role-and-clusterrole) with permissions to access the Kubelet API and perform most common tasks associated with managing pods:
205+
206+
```
207+
cat <<EOF | kubectl apply -f -
208+
apiVersion: rbac.authorization.k8s.io/v1beta1
209+
kind: ClusterRole
210+
metadata:
211+
annotations:
212+
rbac.authorization.kubernetes.io/autoupdate: "true"
213+
labels:
214+
kubernetes.io/bootstrapping: rbac-defaults
215+
name: system:kube-apiserver-to-kubelet
216+
rules:
217+
- apiGroups:
218+
- ""
219+
resources:
220+
- nodes/proxy
221+
- nodes/stats
222+
- nodes/log
223+
- nodes/spec
224+
- nodes/metrics
225+
verbs:
226+
- "*"
227+
EOF
228+
```
229+
230+
The Kubernetes API Server authenticates to the Kubelet as the `kubernetes` user using the client certificate as defined by the `--kubelet-client-certificate` flag.
231+
232+
Bind the `system:kube-apiserver-to-kubelet` ClusterRole to the `kubernetes` user:
233+
234+
```
235+
cat <<EOF | kubectl apply -f -
236+
apiVersion: rbac.authorization.k8s.io/v1beta1
237+
kind: ClusterRoleBinding
238+
metadata:
239+
name: system:kube-apiserver
240+
namespace: ""
241+
roleRef:
242+
apiGroup: rbac.authorization.k8s.io
243+
kind: ClusterRole
244+
name: system:kube-apiserver-to-kubelet
245+
subjects:
246+
- apiGroup: rbac.authorization.k8s.io
247+
kind: User
248+
name: kubernetes
249+
EOF
250+
```
251+
194252
## The Kubernetes Frontend Load Balancer
195253

196254
In this section you will provision an external load balancer to front the Kubernetes API Servers. The `kubernetes-the-hard-way` static IP address will be attached to the resulting load balancer.
@@ -200,15 +258,7 @@ In this section you will provision an external load balancer to front the Kubern
200258
Create the external load balancer network resources:
201259

202260
```
203-
gcloud compute http-health-checks create kube-apiserver-health-check \
204-
--description "Kubernetes API Server Health Check" \
205-
--port 8080 \
206-
--request-path /healthz
207-
```
208-
209-
```
210-
gcloud compute target-pools create kubernetes-target-pool \
211-
--http-health-check=kube-apiserver-health-check
261+
gcloud compute target-pools create kubernetes-target-pool
212262
```
213263

214264
```
@@ -235,27 +285,27 @@ gcloud compute forwarding-rules create kubernetes-forwarding-rule \
235285
Retrieve the `kubernetes-the-hard-way` static IP address:
236286

237287
```
238-
KUBERNETES_PUBLIC_IP_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
288+
KUBERNETES_PUBLIC_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
239289
--region $(gcloud config get-value compute/region) \
240290
--format 'value(address)')
241291
```
242292

243293
Make a HTTP request for the Kubernetes version info:
244294

245295
```
246-
curl --cacert ca.pem https://${KUBERNETES_PUBLIC_IP_ADDRESS}:6443/version
296+
curl --cacert ca.pem https://${KUBERNETES_PUBLIC_ADDRESS}:6443/version
247297
```
248298

249299
> output
250300
251301
```
252302
{
253303
"major": "1",
254-
"minor": "7",
255-
"gitVersion": "v1.7.4",
256-
"gitCommit": "793658f2d7ca7f064d2bdf606519f9fe1229c381",
304+
"minor": "8",
305+
"gitVersion": "v1.8.0",
306+
"gitCommit": "6e937839ac04a38cac63e6a7a306c5d035fe7b0a",
257307
"gitTreeState": "clean",
258-
"buildDate": "2017-08-17T08:30:51Z",
308+
"buildDate": "2017-09-28T22:46:41Z",
259309
"goVersion": "go1.8.3",
260310
"compiler": "gc",
261311
"platform": "linux/amd64"

0 commit comments

Comments
 (0)