Skip to content

Commit

Permalink
Merge pull request #126 from mvallim/v1.20.15
Browse files Browse the repository at this point in the history
v1.20.15
  • Loading branch information
mvallim authored Mar 6, 2022
2 parents a68404d + a4a0ea5 commit f99858a
Show file tree
Hide file tree
Showing 23 changed files with 514 additions and 465 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.19.11***
***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.20.15***

1. Introdution
- [Up and running out of the cloud](documentation/objective.md)
Expand Down
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.19.11-00' ]
- [ apt-get, install, -y, 'kubectl=1.20.15-00' ]
- [ apt-mark, hold, kubectl ]
- [ sh, -c, 'mv -u /run/.ssh/* /home/debian/.ssh/.' ]
- [ chown, -R, 'debian:debian', '/home/debian' ]
Expand Down
30 changes: 24 additions & 6 deletions data/debian/hapx/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ write_files:
- path: /etc/corosync/authkey
permissions: '0400'
content: !!binary |
oazyUUgBg/bkG5cmzZAunHkKozJQ4AKUVTUHcn0tGBXR8OLKsZi3KUWy2bKjeWY6Y44ZFjvuC4sj
1xCt67CRDkHHNuVViK79TCghbfczL6jnkkQNoWfmeMzX2axgp+Wp5tU3jBjGP5X7JMq0eu4RZ2vS
y8iZqL5kYaRqRn3ElD0=
OMTsv6GMyv7yUn2kfWiNA4d7NEudNDUokpxSkL60Czw1AN9t4vs/eOF09nk0STb5yXacjApDAq8J
smu0y/y2g0uQK9T9euYlZmqVuUJVX8afQ/ZYVVrJaB+JwwocTgjXE6jdXB38g8cqBCRSBxenlQpB
OGVN8os72UdniJynZa25gsPlSIrSoKNsoz2sgcZUgrDC3WsCjzQfuvK/RabyJjC997RMRUAvCliH
YnYf3AAFufgTtAxO41APzEg+7bceaxxfSjtv3QdQcLB1O6WoXadX+Ksm1QxfKJX0nz3UA9zKwXCY
mrUVTP1ilpvwkl1VZXYGOiHZakJC0BiayQhJDg==

# The corosync.conf instructs the corosync executive about various parameters
# needed to control the corosync executive. Empty lines and lines starting with
Expand All @@ -47,15 +49,31 @@ write_files:
clear_node_high_bit: yes
crypto_cipher: aes256
crypto_hash: sha256
ip_version: ipv4
interface {
ringnumber: 0
bindnetaddr: 192.168.4.255
bindnetaddr: 192.168.4.128
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
}

nodelist {
node {
ring0_addr: hapx-node01.kube.demo
name: hapx-node01
nodeid: 1
quorum_votes: 1
}
node {
ring0_addr: hapx-node02.kube.demo
name: hapx-node02
nodeid: 2
quorum_votes: 1
}
}

logging {
fileline: off
to_stderr: no
Expand All @@ -74,7 +92,7 @@ write_files:
quorum {
provider: corosync_votequorum
two_node: 1
expected_votes: 2
expected_votes: 1
}

# HAProxy's configuration process involves 3 major sources of parameters :
Expand Down Expand Up @@ -208,7 +226,7 @@ package_upgrade: true

ssh_pwauth: false

manage_etc_hosts: true
manage_etc_hosts: false

fqdn: #HOSTNAME#.kube.demo

Expand Down
6 changes: 3 additions & 3 deletions data/debian/kube/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ runcmd:
- [ sh, -c, 'curl -s https://download.docker.com/linux/debian/gpg | apt-key add -' ]
- [ sh, -c, 'curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -' ]
- [ apt-key, fingerprint, '0EBFCD88' ]
- [ sh, -c, 'echo deb https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/9/amd64/apt/ stretch main > /etc/apt/sources.list.d/gluster.list' ]
- [ 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://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/10/amd64/apt/ buster main > /etc/apt/sources.list.d/gluster.list' ]
- [ sh, -c, 'echo deb [arch=amd64] https://download.docker.com/linux/debian buster 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, containerd.io, 'kubelet=1.19.11-00', 'kubectl=1.19.11-00', 'kubeadm=1.19.11-00' ]
- [ apt-get, install, -y, glusterfs-client, containerd.io, 'kubelet=1.20.15-00', 'kubectl=1.20.15-00', 'kubeadm=1.20.15-00' ]
- [ apt-mark, hold, glusterfs-client, kubelet, kubectl, kubeadm, containerd.io ]
# Configure containerd
- [ mkdir, -p, /etc/containerd ]
Expand Down
2 changes: 1 addition & 1 deletion data/ubuntu/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.19.11-00' ]
- [ apt-get, install, -y, 'kubectl=1.20.15-00' ]
- [ apt-mark, hold, kubectl ]
- [ sh, -c, 'mv -u /run/.ssh/* /home/ubuntu/.ssh/.' ]
- [ chown, -R, 'ubuntu:ubuntu', '/home/ubuntu' ]
Expand Down
22 changes: 19 additions & 3 deletions data/ubuntu/hapx/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,31 @@ write_files:
clear_node_high_bit: yes
crypto_cipher: aes256
crypto_hash: sha256
ip_version: ipv4
interface {
ringnumber: 0
bindnetaddr: 192.168.4.255
bindnetaddr: 192.168.4.128
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
}

nodelist {
node {
ring0_addr: hapx-node01.kube.demo
name: hapx-node01
nodeid: 1
quorum_votes: 1
}
node {
ring0_addr: hapx-node02.kube.demo
name: hapx-node02
nodeid: 2
quorum_votes: 1
}
}

logging {
fileline: off
to_stderr: no
Expand All @@ -74,7 +90,7 @@ write_files:
quorum {
provider: corosync_votequorum
two_node: 1
expected_votes: 2
expected_votes: 1
}

# HAProxy's configuration process involves 3 major sources of parameters :
Expand Down Expand Up @@ -208,7 +224,7 @@ package_upgrade: true

ssh_pwauth: false

manage_etc_hosts: true
manage_etc_hosts: false

fqdn: #HOSTNAME#.kube.demo

Expand Down
6 changes: 3 additions & 3 deletions data/ubuntu/kube/user-data
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ runcmd:
- [ sh, -c, 'curl -s https://download.docker.com/linux/debian/gpg | apt-key add -' ]
- [ sh, -c, 'curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -' ]
- [ apt-key, fingerprint, '0EBFCD88' ]
- [ sh, -c, 'echo deb https://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/9/amd64/apt/ stretch main > /etc/apt/sources.list.d/gluster.list' ]
- [ 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://download.gluster.org/pub/gluster/glusterfs/7/LATEST/Debian/10/amd64/apt/ buster main > /etc/apt/sources.list.d/gluster.list' ]
- [ sh, -c, 'echo deb [arch=amd64] https://download.docker.com/linux/debian buster 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, containerd.io, 'kubelet=1.19.11-00', 'kubectl=1.19.11-00', 'kubeadm=1.19.11-00' ]
- [ apt-get, install, -y, glusterfs-client, containerd.io, 'kubelet=1.20.15-00', 'kubectl=1.20.15-00', 'kubeadm=1.20.15-00' ]
- [ apt-mark, hold, glusterfs-client, kubelet, kubectl, kubeadm, containerd.io ]
# Configure containerd
- [ mkdir, -p, /etc/containerd ]
Expand Down
30 changes: 14 additions & 16 deletions documentation/create-linux-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ This document shows how to create a Debian image from scratch to run on Cloud en
--variant=minbase \
--components "main" \
--include "ca-certificates,cron,iptables,isc-dhcp-client,libnss-myhostname,ntp,ntpdate,rsyslog,ssh,sudo,dialog,whiptail,man-db,curl,dosfstools,e2fsck-static" \
stretch \
buster \
$HOME/debian-image-from-scratch/chroot \
http://deb.debian.org/debian/
```
Expand Down Expand Up @@ -250,14 +250,14 @@ This document shows how to create a Debian image from scratch to run on Cloud en
```bash
cat <<EOF > /etc/apt/sources.list
deb http://deb.debian.org/debian/ stretch main contrib non-free
deb-src http://deb.debian.org/debian/ stretch main contrib non-free
deb http://deb.debian.org/debian/ buster main contrib non-free
deb-src http://deb.debian.org/debian/ buster main contrib non-free
deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb http://deb.debian.org/debian/ buster-updates main contrib non-free
deb-src http://deb.debian.org/debian/ buster-updates main contrib non-free
deb http://deb.debian.org/debian-security stretch/updates main
deb-src http://deb.debian.org/debian-security stretch/updates main
deb http://deb.debian.org/debian-security buster/updates main
deb-src http://deb.debian.org/debian-security buster/updates main
EOF
```
Expand Down Expand Up @@ -436,10 +436,8 @@ This document shows how to create a Debian image from scratch to run on Cloud en
GRUB_DEFAULT=0
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
GRUB_CMDLINE_LINUX=""
EOF
```
Expand Down Expand Up @@ -530,20 +528,20 @@ If you plan to use this image in **VirtualBox**, install [**VirtualBox Guest Add
total 12
drwxr-xr-x 3 root root 4096 Feb 2 23:36 .
drwxr-xr-x 14 root root 4096 Feb 2 23:36 ..
drwxr-xr-x 3 root root 4096 Feb 2 23:36 4.9.0-15-amd64
drwxr-xr-x 3 root root 4096 Feb 2 23:36 4.19.0-18-amd64
```
Refer to the file name listed. In this case, `4.9.0-15-amd64`:
Refer to the file name listed. In this case, `4.19.0-18-amd64`:
```bash
rcvboxadd quicksetup 4.9.0-15-amd64
rcvboxadd quicksetup 4.19.0-18-amd64
```
Expected output
```console
VirtualBox Guest Additions: Building the modules for kernel 4.9.0-15-amd64.
update-initramfs: Generating /boot/initrd.img-4.9.0-15-amd64
VirtualBox Guest Additions: Building the modules for kernel 4.19.0-18-amd64.
update-initramfs: Generating /boot/initrd.img-4.19.0-18-amd64
```
5. Umount and remove the ISO file:
Expand Down
12 changes: 6 additions & 6 deletions 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-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64
Linux busybox 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) 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 @@ -455,15 +455,15 @@ Press **ctrl+b** and **shit+:**, type the following command and hit ENTER:

```console
curl -L --progress \
https://github.com/etcd-io/etcd/releases/download/v3.4.7/etcd-v3.4.7-linux-amd64.tar.gz \
-o /tmp/etcd-v3.4.7-linux-amd64.tar.gz
https://github.com/etcd-io/etcd/releases/download/v3.4.16/etcd-v3.4.16-linux-amd64.tar.gz \
-o /tmp/etcd-v3.4.16-linux-amd64.tar.gz

tar xvzf /tmp/etcd-v3.4.7-linux-amd64.tar.gz
tar xvzf /tmp/etcd-v3.4.16-linux-amd64.tar.gz

sudo mv etcd-v3.4.7-linux-amd64/etcd* /usr/local/bin/.
sudo mv etcd-v3.4.16-linux-amd64/etcd* /usr/local/bin/.
sudo chown root:root /usr/local/bin/etcd*

rm -rf etcd-v3.4.7-linux-amd64
rm -rf etcd-v3.4.16-linux-amd64
```

5. Create a unit service file to run on `systemd`
Expand Down
39 changes: 29 additions & 10 deletions documentation/haproxy-cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ write_files:
- path: /etc/corosync/authkey
permissions: '0400'
content: !!binary |
oazyUUgBg/bkG5cmzZAunHkKozJQ4AKUVTUHcn0tGBXR8OLKsZi3KUWy2bKjeWY6Y44ZFjvuC4sj
1xCt67CRDkHHNuVViK79TCghbfczL6jnkkQNoWfmeMzX2axgp+Wp5tU3jBjGP5X7JMq0eu4RZ2vS
y8iZqL5kYaRqRn3ElD0=
OMTsv6GMyv7yUn2kfWiNA4d7NEudNDUokpxSkL60Czw1AN9t4vs/eOF09nk0STb5yXacjApDAq8J
smu0y/y2g0uQK9T9euYlZmqVuUJVX8afQ/ZYVVrJaB+JwwocTgjXE6jdXB38g8cqBCRSBxenlQpB
OGVN8os72UdniJynZa25gsPlSIrSoKNsoz2sgcZUgrDC3WsCjzQfuvK/RabyJjC997RMRUAvCliH
YnYf3AAFufgTtAxO41APzEg+7bceaxxfSjtv3QdQcLB1O6WoXadX+Ksm1QxfKJX0nz3UA9zKwXCY
mrUVTP1ilpvwkl1VZXYGOiHZakJC0BiayQhJDg==

# The corosync.conf instructs the Corosync executive about various parameters
# needed to control it.
Expand All @@ -172,15 +174,31 @@ write_files:
clear_node_high_bit: yes
crypto_cipher: aes256
crypto_hash: sha256
ip_version: ipv4
interface {
ringnumber: 0
bindnetaddr: 192.168.4.255
bindnetaddr: 192.168.4.128
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
}

nodelist {
node {
ring0_addr: hapx-node01.kube.demo
name: hapx-node01
nodeid: 1
quorum_votes: 1
}
node {
ring0_addr: hapx-node02.kube.demo
name: hapx-node02
nodeid: 2
quorum_votes: 1
}
}

logging {
fileline: off
to_stderr: no
Expand All @@ -199,7 +217,7 @@ write_files:
quorum {
provider: corosync_votequorum
two_node: 1
expected_votes: 2
expected_votes: 1
}

# HAProxy's configuration process involves 3 major sources of parameters :
Expand Down Expand Up @@ -333,7 +351,7 @@ package_upgrade: true

ssh_pwauth: false

manage_etc_hosts: true
manage_etc_hosts: false

fqdn: #HOSTNAME#.kube.demo

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

```console
Linux busybox 4.9.0-15-amd64 #1 SMP Debian 4.9.258-1 (2021-03-08) x86_64
Linux busybox 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) 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 @@ -444,13 +462,14 @@ Before carrying out with the Pacemaker configuration, it is worth making some ob

```console
debian@hapx-node01:~$ cat <<EOF | sudo crm configure
property stonith-enabled=no
property startup-fencing=false
property stonith-enabled=false
property no-quorum-policy=ignore
rsc_defaults resource-stickiness=100
primitive virtual-ip-resource ocf:heartbeat:IPaddr2 params ip="192.168.4.20" broadcast=192.168.4.31 nic=enp0s3.41 cidr_netmask=27 meta migration-threshold=2 op monitor interval=20 timeout=60 on-fail=restart
primitive haproxy-resource ocf:heartbeat:haproxy op monitor interval=20 timeout=60 on-fail=restart
colocation loc inf: virtual-ip-resource haproxy-resource
order ord inf: virtual-ip-resource haproxy-resource
order ord Mandatory: virtual-ip-resource haproxy-resource
commit
bye
EOF
Expand Down Expand Up @@ -541,7 +560,7 @@ ssh debian@gate-node01

In our case, since the `haproxy-resource` should be colocated with the `virtual-ip-resource`, the `haproxy-resource` **will be allocated on the same node where the `virtual-ip-resource` is**.

* `order ord inf: virtual-ip-resource haproxy-resource`
* `order ord Mandatory: 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`.

Expand Down
Loading

0 comments on commit f99858a

Please sign in to comment.