Skip to content

Commit

Permalink
Merge pull request #115 from mvallim/1.18.17
Browse files Browse the repository at this point in the history
1.18.17
  • Loading branch information
mvallim authored Mar 22, 2021
2 parents 2af677d + c550b11 commit c34b2c3
Show file tree
Hide file tree
Showing 18 changed files with 324 additions and 301 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The target audience for this tutorial is someone planning to install a Kubernete

## Index

***Atention**: the documentation for this project is being actively improved to explain the demonstrated concepts clearly. If you face any difficulties while following the steps described in the documentation, please open an issue, so we can keep improving it. The version of Kubernetes used here is **1.16.15***
***Atention**: the documentation for this project is being actively improved to explain the demonstrated concepts clearly. If you face any difficulties while following the steps described in the documentation, please open an issue, so we can keep improving it. The version of Kubernetes used here is **1.18.17***

1. Introdution
- [Up and running out of the cloud](documentation/objective.md)
Expand Down
2 changes: 1 addition & 1 deletion data/debian/busybox/post-config-resources
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
processors: 1
memory: 1024
memory: 512
2 changes: 1 addition & 1 deletion data/debian/busybox/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ runcmd:
- [ sh, -c, 'curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -' ]
- [ sh, -c, 'echo deb https://apt.kubernetes.io/ kubernetes-xenial main > /etc/apt/sources.list.d/kubernetes.list' ]
- [ apt-get, update ]
- [ apt-get, install, -y, 'kubectl=1.16.15-00' ]
- [ apt-get, install, -y, 'kubectl=1.18.17-00' ]
- [ apt-mark, hold, kubectl ]
- [ sh, -c, 'mv -u /run/.ssh/* /home/debian/.ssh/.' ]
- [ chown, -R, 'debian:debian', '/home/debian' ]
Expand Down
2 changes: 1 addition & 1 deletion data/debian/kube-node/post-config-resources
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
processors: 4
processors: 2
memory: 2048
2 changes: 1 addition & 1 deletion data/debian/kube/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ runcmd:
- [ sh, -c, 'echo deb [arch=amd64] https://download.docker.com/linux/debian stretch stable > /etc/apt/sources.list.d/docker-ce.list' ]
- [ sh, -c, 'echo deb https://apt.kubernetes.io/ kubernetes-xenial main > /etc/apt/sources.list.d/kubernetes.list' ]
- [ apt-get, update ]
- [ apt-get, install, -y, glusterfs-client, 'docker-ce=18.06.0~ce~3-0~debian', containerd.io, 'kubelet=1.16.15-00', 'kubectl=1.16.15-00', 'kubeadm=1.16.15-00' ]
- [ apt-get, install, -y, glusterfs-client, 'docker-ce=18.06.0~ce~3-0~debian', containerd.io, 'kubelet=1.18.17-00', 'kubectl=1.18.17-00', 'kubeadm=1.18.17-00' ]
- [ apt-mark, hold, glusterfs-client, kubelet, kubectl, kubeadm, docker-ce, containerd.io ]
# SSH server to trust the CA
- [ sh, -c, 'echo >> /etc/ssh/sshd_config' ]
Expand Down
2 changes: 1 addition & 1 deletion data/ubuntu/busybox/post-config-resources
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
processors: 1
memory: 1024
memory: 512
2 changes: 1 addition & 1 deletion data/ubuntu/kube-node/post-config-resources
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
processors: 4
processors: 2
memory: 2048
2 changes: 1 addition & 1 deletion documentation/etcd.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Use the returned value to access.
Expected output:

```console
Linux busybox 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
Linux busybox 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
Expand Down
16 changes: 8 additions & 8 deletions documentation/haproxy-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Each of the **HAProxy** load balancers will be configured to split traffic betwe

*"HAProxy is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. It is particularly suited for very high traffic web sites and powers quite a number of the world's most visited ones. Over the years it has become the de-facto standard opensource load balancer, is now shipped with most mainstream Linux distributions, and is often deployed by default in cloud platforms. Since it does not advertise itself, we only know it's used when the admins report it :-)"*

**Reference:** http://www.haproxy.org/
**Reference:** <http://www.haproxy.org/>

> Full explanation in our [Technology Stack](technologies.md#HAProxy).
Expand Down Expand Up @@ -46,13 +46,13 @@ Resource Agents are the abstraction that allows Pacemaker to manage services it

This Linux-specific resource manages IP alias IP addresses. It can add an IP alias, or remove one. In addition, it can implement Cluster Alias IP functionality if invoked as a clone resource.

> More info http://linux-ha.org/doc/man-pages/re-ra-IPaddr2.html
> More info <http://linux-ha.org/doc/man-pages/re-ra-IPaddr2.html>
#### `ocf:heartbeat:haproxy`

Manages haproxy daemon as an OCF resource in an High Availability setup.

> More info https://raw.githubusercontent.com/russki/cluster-agents/master/haproxy
> More info <https://raw.githubusercontent.com/russki/cluster-agents/master/haproxy>
## Create the VMs

Expand Down Expand Up @@ -377,7 +377,7 @@ Use the returned value to access to ssh into the VM:
Expected output:

```console
Linux busybox 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
Linux busybox 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
Expand Down Expand Up @@ -528,8 +528,8 @@ Before carrying out with the Pacemaker configuration, it is worth making some ob
* `fence` - STONITH the node on which the resource failed.
* `standby` - Move all resources away from the node on which the resource failed.

> Reference: http://www.linux-ha.org/doc/man-pages/re-ra-IPaddr2.html
> Reference: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/high_availability_add-on_reference/s1-resourceoperate-haar
> Reference: <http://www.linux-ha.org/doc/man-pages/re-ra-IPaddr2.html>
> Reference: <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/high_availability_add-on_reference/s1-resourceoperate-haar>
* `primitive haproxy-resource ocf:heartbeat:haproxy op monitor interval=20 timeout=60 on-fail=restart`
ssh debian@gate-node01
Expand All @@ -543,7 +543,7 @@ ssh debian@gate-node01

* `order ord inf: virtual-ip-resource haproxy-resource`

The `order` constraints tell the cluster the order in which resources should be allocated. In this case, we are informing that the `virtual-ip-resource` should always be allocated before the `haproxy-resource`.
The `order` constraints tell the cluster the order in which resources should be allocated. In this case, we are informing that the `virtual-ip-resource` should always be allocated before the `haproxy-resource`.

Ordering constraints affect only the ordering in which resources are created. They do not cause the resources be **colocated** on the same node.

Expand Down Expand Up @@ -587,7 +587,6 @@ ssh debian@gate-node01

Looking closer, we can see that the `hapx-node01` node is the one that has these two resources (`virtual-ip-resource` and `haproxy-resource`) allocated. That makes perfect sense, as we configured these resources to be always allocated on the same node.


### View HAProxy stats page

Now that everything is set up, you can access the HAProxy stats through the Virtual IP we just configured.
Expand Down Expand Up @@ -616,6 +615,7 @@ This will be fixed once we setup our Kubernetes Master nodes.
Shutdown one of the two VMs (hapx-node01 or hapx-node02) and press F5 in the browser where you have opened the HAProxy statistics. No difference or error should be noticed. :)

## Conclusion

We got deep into configuring an HAProxy Cluster with high availability supported by Corosync and Pacemaker. We configured each of the components individually and also configured an Elastic IP that allows the HAProxy Cluster to failover transparently when any of its nodes fail.

I hope you had fun configuring your cluster and learned some nice useful stuff along the way.
48 changes: 25 additions & 23 deletions documentation/kube-dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ Use the returned value to access the BusyBox:

Expected output:

```text
Linux busybox 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
```console
Linux busybox 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
```
Expand All @@ -61,7 +63,7 @@ permitted by applicable law.
2. Install the Dashboard by applying the `kubernetes-dashboard.yaml` file:

```console
debian@busybox:~$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0/aio/deploy/recommended.yaml
debian@busybox:~$ kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
```

Expected output:
Expand Down Expand Up @@ -92,12 +94,12 @@ permitted by applicable law.
Expected output:

```text
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
dashboard-metrics-scraper-c79c65bb7-jgkpf 1/1 Running 0 15s 10.244.4.2 kube-node02 <none> <none>
kubernetes-dashboard-56484d4c5-27c6g 1/1 Running 0 15s 10.244.5.2 kube-node03 <none> <none>
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
dashboard-metrics-scraper-78f5d9f487-ptvqb 1/1 Running 0 26s 10.244.3.2 kube-node01 <none> <none>
kubernetes-dashboard-577bd97bc-5jpkd 1/1 Running 0 26s 10.244.4.2 kube-node02 <none> <none>
```

> Notice we now have a pod named `kubernetes-dashboard-56c5f95c6b-ptcw6`
> Notice we now have a pod named `kubernetes-dashboard-577bd97bc-5jpkd`
## Configure the Dashboard

Expand Down Expand Up @@ -142,43 +144,43 @@ To access the Dashboard, we need to have a token from the `cluster-admin-dashboa

```text
NAME TYPE DATA AGE
cluster-admin-dashboard-token-7b2qq kubernetes.io/service-account-token 3 12s
default-token-xj4q7 kubernetes.io/service-account-token 3 54s
kubernetes-dashboard-certs Opaque 0 54s
kubernetes-dashboard-csrf Opaque 1 54s
kubernetes-dashboard-key-holder Opaque 2 54s
kubernetes-dashboard-token-89wh5 kubernetes.io/service-account-token 3 54s
cluster-admin-dashboard-token-jvzbm kubernetes.io/service-account-token 3 16s
default-token-jp4kc kubernetes.io/service-account-token 3 86s
kubernetes-dashboard-certs Opaque 0 86s
kubernetes-dashboard-csrf Opaque 1 86s
kubernetes-dashboard-key-holder Opaque 2 86s
kubernetes-dashboard-token-sxrp9 kubernetes.io/service-account-token 3 86s
```

> We can see the `cluster-admin-dashboard` service account token has a token named `cluster-admin-dashboard-token-7b2qq`
> We can see the `cluster-admin-dashboard` service account token has a token named `cluster-admin-dashboard-token-jvzbm`
2. To fetch the token, describe the `cluster-admin-dashboard-token-7b2qq` secret:
2. To fetch the token, describe the `cluster-admin-dashboard-token-jvzbm` secret:

```console
debian@busybox:~$ kubectl describe secret cluster-admin-dashboard-token-7b2qq -n kubernetes-dashboard
debian@busybox:~$ kubectl describe secret cluster-admin-dashboard-token-jvzbm -n kubernetes-dashboard
```

Expected output:

```text
Name: cluster-admin-dashboard-token-7b2qq
Name: cluster-admin-dashboard-token-jvzbm
Namespace: kubernetes-dashboard
Labels: <none>
Annotations: kubernetes.io/service-account.name: cluster-admin-dashboard
kubernetes.io/service-account.uid: bbad3979-8372-4082-b5c1-8ff051ff0e15
kubernetes.io/service-account.uid: 181b0dd6-561d-4dcf-9f66-58fd154b5a7d
Type: kubernetes.io/service-account-token
Data
====
ca.crt: 1025 bytes
namespace: 20 bytes
token: eyJhbGciOiJSUzI1NiIsImtpZCI6Ii1TWkw3a01zSlh4SkNPVmRSUTlsZ0lKT2oxQkVaMEplQzB0TVN3TnNLbE0ifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJjbHVzdGVyLWFkbWluLWRhc2hib2FyZC10b2tlbi03YjJxcSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJjbHVzdGVyLWFkbWluLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImJiYWQ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b3VudDprdWJlcm5ldGVzLWRhc2hib2FyZDpjbHVzdGVyLWFkbWluLWRhc2hib2FyZCJ9.uibwq9m149OSdWG8FJGYJIxEBQle_QEVTnctBMY_67_HkCVLBA0R9d2brGhcw-bq9_IQWfOkMLRBj3duPr7YBTqKg53i6jXsnKnlh_t_UOCjx543or5Aw5HgcasslfHAVken6CtcEIYin4ya1LOb5DNH7mfHvdGWDFzTsSM3TxXe4FD6rvLfS-S0ICju7RBRLaOsrEptGjoX7z7mRXoQbeO3cFRlMsOQG7uShxgfz9BZDYrYICYw3YjhupQ9FXvWe_guLCA4XD3GNpPVp8bSgX_UayvgMouAleYs93QrlKqdBT0oD72VEFAHr0GeRjnoC9z-XDBixeaM4BFxGuAfqw
```

> We are going to use the `eyJhbGciOiJSUzI1NiIsImtpZCI6Ii1TWkw3...ZYOhTNR15aFmbWj5L62pLIh0JGMomr-8-V_WH2es5qWmjCeDU-B8dVNkPw` token. For shortness, we show only the first and last blocks here, but we must use the full printed value to access the Dashboard.
> We are going to use the `eyJhbGciOiJSUzI1NiIsImtpZCI6ImpTTHVJZ0h6L...72VEFAHr0GeRjnoC9z-XDBixeaM4BFxGuAfqw` token. For shortness, we show only the first and last blocks here, but we must use the full printed value to access the Dashboard.
### Access the Dashboard
### View the Dashboard

1. To view the Dashboard, open your browser at [https://192.168.4.20:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/](https://192.168.4.20:6443/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/)

Expand Down
20 changes: 10 additions & 10 deletions documentation/kube-demo-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,21 @@ The `redis-slave` and `redis-master` Services you applied are only accessible wi

The response should look similar to this:

```text
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kube-mast01 Ready master 73m v1.15.6 192.168.1.64 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
kube-mast02 Ready master 69m v1.15.6 192.168.1.69 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
kube-mast03 Ready master 65m v1.15.6 192.168.1.170 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
kube-node01 Ready <none> 51m v1.15.6 192.168.2.136 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
kube-node02 Ready <none> 50m v1.15.6 192.168.2.205 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
kube-node03 Ready <none> 50m v1.15.6 192.168.2.195 <none> Debian GNU/Linux 9 (stretch) 4.9.0-11-amd64 docker://18.6.0
```console
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kube-mast01 Ready master 56m v1.18.17 192.168.1.85 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
kube-mast02 Ready master 47m v1.18.17 192.168.1.164 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
kube-mast03 Ready master 45m v1.18.17 192.168.1.212 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
kube-node01 Ready <none> 20m v1.18.17 192.168.2.213 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
kube-node02 Ready <none> 20m v1.18.17 192.168.2.171 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
kube-node03 Ready <none> 19m v1.18.17 192.168.2.216 <none> Debian GNU/Linux 9 (stretch) 4.9.0-15-amd64 docker://18.6.0
```

2. Choice any ip of `kube-nodes` (`kube-node01`, `kube-node02` or `kube-node03`)

Here we will use the `192.168.2.136` (`kube-node01`)
Here we will use the `192.168.2.213` (`kube-node01`)

Open your browser with address [http://192.168.2.136:30551](http://192.168.2.136:30551)
Open your browser with address [http://192.168.2.213:30551](http://192.168.2.136:30551)

> Keep attention on port **`30551`**, you should change correspondent port show in your on output above.
Expand Down
Loading

0 comments on commit c34b2c3

Please sign in to comment.