ungleich-k8s/v3-calico/README.md

173 lines
4.7 KiB
Markdown
Raw Permalink Normal View History

2021-05-29 23:12:21 +00:00
2021-05-20 17:32:50 +00:00
## Introduction
The following guide shows how to setup an IPv6 only cluster at ungleich.
2021-05-16 20:51:12 +00:00
## Steps
- Boot Alpine
2021-05-20 17:32:50 +00:00
- Configure with cdist to get cri-o configured
2021-05-16 20:51:12 +00:00
## Control plane
2021-05-20 17:32:50 +00:00
Initialise with all components:
```
2021-05-29 23:12:21 +00:00
kubeadm init --config kubeadm-config.yaml
2021-05-20 17:32:50 +00:00
```
2021-05-29 23:12:21 +00:00
We need to specify the **--config** option to inject correct cgroupdriver!
2021-05-20 17:32:50 +00:00
We cannot yet skip kube-proxy, because calico does not support eBPF
for IPv6. Cilium supports IPv6 eBPF, but on the other hand does not
support automatic BGP peering. So the following **does not** work:
2021-05-16 20:51:12 +00:00
```
kubeadm init --skip-phases=addon/kube-proxy --service-cidr 2a0a:e5c0:13:aaa::/108 --pod-network-cidr 2a0a:e5c0:13:bbb::/64
kubeadm init --service-cidr 2a0a:e5c0:13:aaa::/108 --pod-network-cidr 2a0a:e5c0:13:bbb::/64
2021-05-16 20:51:12 +00:00
```
2021-05-20 17:32:50 +00:00
2021-05-16 20:51:12 +00:00
## Worker nodes
```
2021-05-16 21:07:15 +00:00
kubeadm join [2a0a:e5c0:13:0:225:b3ff:fe20:38cc]:6443 --token bw3x98.chp31kcgcd4b5fpf --discovery-token-ca-cert-hash sha256:...
2021-05-16 20:51:12 +00:00
```
## CNI/networking
```
kubectl apply -f calico.yaml
```
Warning: needs to be updated:
```
serviceaccount/calico-kube-controllers created
Warning: policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
poddisruptionbudget.policy/calico-kube-controllers created
```
Checking pods:
```
[21:53] server47.place7:~/v3-calico# kubectl -n kube-system get pods
NAME READY STATUS RESTARTS AGE
calico-kube-controllers-6d8ccdbf46-4xzz9 0/1 Pending 0 60s
calico-node-5gkp9 0/1 Init:0/3 0 60s
calico-node-8lct9 0/1 Init:0/3 0 60s
calico-node-jmjhn 0/1 Init:0/3 0 60s
calico-node-krnzr 0/1 Init:ErrImagePull 0 60s
coredns-558bd4d5db-4rvrf 0/1 Pending 0 3m40s
coredns-558bd4d5db-g9lbx 0/1 Pending 0 3m40s
etcd-server47 1/1 Running 0 3m56s
kube-apiserver-server47 1/1 Running 0 3m55s
kube-controller-manager-server47 1/1 Running 0 3m56s
kube-scheduler-server47 1/1 Running 0 3m55s
[21:54] server47.place7:~/v3-calico#
```
2021-05-16 21:07:15 +00:00
## Getting calicoctl
```
kubectl apply -f https://docs.projectcalico.org/manifests/calicoctl.yaml
```
And alias it:
```
alias calicoctl="kubectl exec -i -n kube-system calicoctl -- /calicoctl"
```
## Configuring BGP routing
```
calicoctl create -f - < bgp....yaml
```
2021-05-20 17:28:39 +00:00
## Setup a test deployment
Do *NOT* use https://k8s.io/examples/application/deployment.yaml. It
contains an outdated nginx container that has no IPv6 listener. You
will get results such as
```
[19:03] server47.place7:~/ungleich-k8s/v3-calico# curl http://[2a0a:e5c0:13:bbb:176b:eaa6:6d47:1c41]
curl: (7) Failed to connect to 2a0a:e5c0:13:bbb:176b:eaa6:6d47:1c41 port 80: Connection refused
```
if you use that deployment. Instead use something on the line of the
included **nginx-test-deployment.yaml**:
```
2021-05-20 17:34:12 +00:00
kubectl apply -f nginx-test-deployment.yaml
2021-05-20 17:28:39 +00:00
```
2021-05-29 23:12:21 +00:00
## Kubevirt
Based on https://kubevirt.io/user-guide/operations/installation/:
```
2021-06-15 23:20:59 +00:00
export RELEASE=v0.42.1
2021-05-29 23:12:21 +00:00
# Deploy the KubeVirt operator
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-operator.yaml
# Create the KubeVirt CR (instance deployment request) which triggers the actual installation
kubectl apply -f https://github.com/kubevirt/kubevirt/releases/download/${RELEASE}/kubevirt-cr.yaml
```
This never happens:
```
# wait until all KubeVirt components are up
$ kubectl -n kubevirt wait kv kubevirt --for condition=Available
```
## Old/obsolete information
### Alpine / kubelet hack
Due to some misconfiguration on alpine, **DURING** the **kubeadm
init** we need to modify the **generated**
/var/lib/kubelet/config.yaml to replace "cgroupDriver: systemd" with
"cgroupDriver: cgroupfs".
The same is necessary on the worker nodes, however that can be done
anytime before you plan to schedule containers on them, after the
**kubeadm join** request.
**THIS is fixed if we use a kubeadm config file specifying the cgroupdriver**.
2021-06-04 16:59:17 +00:00
## Calico notes
Requires
```
mount --make-shared /sys
```
## Kubevirt nodes
Requires
```
mount --make-shared /
```
2021-06-04 17:21:28 +00:00
## Manual / post boot changes for place7-v2 cluster
```
mount --make-shared /
mount --make-shared /sys
sysctl net.ipv6.conf.eth0.accept_ra=2
2021-06-05 17:15:15 +00:00
modprobe br_netfilter
sysctl -p /etc/sysctl.d/99-Z-sysctl-cdist.conf
2021-06-04 17:21:28 +00:00
```
2021-06-05 17:15:15 +00:00
## Docker based
2021-06-05 17:30:56 +00:00
```
mount --make-shared /sys
mount --make-shared /run/
```