Skip to content

Commit 69cb414

Browse files
committed
docs: update cilium install instructions
Update cilium install instructions. Signed-off-by: Noel Georgi <git@frezbo.dev>
1 parent e71cc66 commit 69cb414

File tree

1 file changed

+158
-71
lines changed

1 file changed

+158
-71
lines changed

website/content/v1.4/kubernetes-guides/network/deploying-cilium.md

Lines changed: 158 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,99 @@ aliases:
55
- ../../guides/deploying-cilium
66
---
77

8-
From v1.9 onwards Cilium does no longer provide a one-liner install manifest that can be used to install Cilium on a node via `kubectl apply -f` or passing it in as an extra url in the `urls` part in the Talos machine configuration.
8+
> Cilium can be installed either via the `cilium` cli or using `helm`.
99
10-
> Installing Cilium the new way via the `cilium` cli is broken, so we'll be using `helm` to install Cilium.
11-
For more information: [Install with CLI fails, works with Helm](https://github.com/cilium/cilium-cli/issues/505)
12-
13-
Refer to [Installing with Helm](https://docs.cilium.io/en/v1.11/gettingstarted/k8s-install-helm/) for more information.
14-
15-
First we'll need to add the helm repo for Cilium.
16-
17-
```bash
18-
helm repo add cilium https://helm.cilium.io/
19-
helm repo update
20-
```
21-
22-
This documentation will outline installing Cilium CNI v1.11.2 on Talos in four different ways.
23-
Adhering to Talos principles we'll deploy Cilium with IPAM mode set to Kubernetes.
24-
Each method can either install Cilium using kube proxy (default) or without: [Kubernetes Without kube-proxy](https://docs.cilium.io/en/v1.11/gettingstarted/kubeproxy-free/)
10+
This documentation will outline installing Cilium CNI v1.13.0 on Talos in six different ways.
11+
Adhering to Talos principles we'll deploy Cilium with IPAM mode set to Kubernetes, and using the `cgroupv2` mount that talos already provides.
12+
As Talos does not allow loading kernel modules by Kubernetes workloads, `SYS_MODULE` capability needs to be dropped from the Cilium default set of values, this override can be seen in the helm/cilium cli install commands.
13+
Each method can either install Cilium using kube proxy (default) or without: [Kubernetes Without kube-proxy](https://docs.cilium.io/en/v1.13/network/kubernetes/kubeproxy-free/)
2514

2615
## Machine config preparation
2716

2817
When generating the machine config for a node set the CNI to none.
2918
For example using a config patch:
3019

20+
Create a `patch.yaml` file with the following contents:
21+
22+
```yaml
23+
cluster:
24+
network:
25+
cni:
26+
name: none
27+
```
28+
3129
```bash
3230
talosctl gen config \
3331
my-cluster https://mycluster.local:6443 \
34-
--config-patch '[{"op":"add", "path": "/cluster/network/cni", "value": {"name": "none"}}]'
32+
--config-patch @patch.yaml
3533
```
3634

3735
Or if you want to deploy Cilium in strict mode without kube-proxy, you also need to disable kube proxy:
3836

37+
Create a `patch.yaml` file with the following contents:
38+
39+
```yaml
40+
cluster:
41+
network:
42+
cni:
43+
name: none
44+
proxy:
45+
disabled: true
46+
```
47+
3948
```bash
4049
talosctl gen config \
4150
my-cluster https://mycluster.local:6443 \
42-
--config-patch '[{"op": "add", "path": "/cluster/proxy", "value": {"disabled": true}}, {"op":"add", "path": "/cluster/network/cni", "value": {"name": "none"}}]'
51+
--config-patch @patch.yaml
4352
```
4453

45-
## Method 1: Helm install
54+
### Installation using Cilium CLI
55+
56+
> Note: It is recommended to template the cilium manifest using helm and use it as part of Talos machine config, but if you want to install Cilium using the Cilium CLI, you can follow the steps below.
57+
58+
Install the [Cilium CLI](https://docs.cilium.io/en/v1.13/gettingstarted/k8s-install-default/#install-the-cilium-cli) following the steps here.
59+
60+
#### With kube-proxy
61+
62+
```bash
63+
cilium install \
64+
--helm-set=ipam.mode=kubernetes \
65+
--helm-set=kubeProxyReplacement=disabled \
66+
--helm-set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
67+
--helm-set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
68+
--helm-set=cgroup.autoMount.enabled=false \
69+
--helm-set=cgroup.hostRoot=/sys/fs/cgroup
70+
```
71+
72+
#### Without kube-proxy
73+
74+
```bash
75+
export KUBERNETES_API_SERVER_ADDRESS=<replace with api server endpoint here> # e.g. 10.96.0.1
76+
export KUBERNETES_API_SERVER_PORT=6443
77+
78+
cilium install \
79+
--helm-set=ipam.mode=kubernetes \
80+
--helm-set=kubeProxyReplacement=strict \
81+
--helm-set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
82+
--helm-set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
83+
--helm-set=cgroup.autoMount.enabled=false \
84+
--helm-set=cgroup.hostRoot=/sys/fs/cgroup \
85+
--helm-set=k8sServiceHost="${KUBERNETES_API_SERVER_ADDRESS}" \
86+
--helm-set=k8sServicePort="${KUBERNETES_API_SERVER_PORT}"
87+
```
88+
89+
### Installation using Helm
90+
91+
Refer to [Installing with Helm](https://docs.cilium.io/en/v1.13/installation/k8s-install-helm/) for more information.
92+
93+
First we'll need to add the helm repo for Cilium.
94+
95+
```bash
96+
helm repo add cilium https://helm.cilium.io/
97+
helm repo update
98+
```
99+
100+
### Method 1: Helm install
46101

47102
After applying the machine config and bootstrapping Talos will appear to hang on phase 18/19 with the message: retrying error: node not ready.
48103
This happens because nodes in Kubernetes are only marked as ready once the CNI is up.
@@ -51,100 +106,148 @@ As there is no CNI defined, the boot process is pending and will reboot the node
51106
During this window you can install Cilium manually by running the following:
52107

53108
```bash
54-
helm install cilium cilium/cilium \
55-
--version 1.11.2 \
109+
helm install \
110+
cilium \
111+
cilium/cilium \
112+
--version 1.13.0 \
56113
--namespace kube-system \
57-
--set ipam.mode=kubernetes
114+
--set ipam.mode=kubernetes \
115+
--set=kubeProxyReplacement=disabled \
116+
--set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
117+
--set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
118+
--set=cgroup.autoMount.enabled=false \
119+
--set=cgroup.hostRoot=/sys/fs/cgroup
58120
```
59121

60122
Or if you want to deploy Cilium in strict mode without kube-proxy, also set some extra paramaters:
61123

62124
```bash
63-
export KUBERNETES_API_SERVER_ADDRESS=<>
125+
export KUBERNETES_API_SERVER_ADDRESS=<replace with api server endpoint here> # e.g. 10.96.0.1
64126
export KUBERNETES_API_SERVER_PORT=6443
65127

66-
helm install cilium cilium/cilium \
67-
--version 1.11.2 \
128+
helm install \
129+
cilium \
130+
cilium/cilium \
131+
--version 1.13.0 \
68132
--namespace kube-system \
69133
--set ipam.mode=kubernetes \
70-
--set kubeProxyReplacement=strict \
71-
--set k8sServiceHost="${KUBERNETES_API_SERVER_ADDRESS}" \
72-
--set k8sServicePort="${KUBERNETES_API_SERVER_PORT}"
134+
--set=kubeProxyReplacement=strict \
135+
--set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
136+
--set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
137+
--set=cgroup.autoMount.enabled=false \
138+
--set=cgroup.hostRoot=/sys/fs/cgroup \
139+
--set=k8sServiceHost="${KUBERNETES_API_SERVER_ADDRESS}" \
140+
--set=k8sServicePort="${KUBERNETES_API_SERVER_PORT}"
73141
```
74142

75143
After Cilium is installed the boot process should continue and complete successfully.
76144

77-
## Method 2: Helm manifests install
145+
### Method 2: Helm manifests install
78146

79147
Instead of directly installing Cilium you can instead first generate the manifest and then apply it:
80148

81149
```bash
82-
helm template cilium cilium/cilium \
83-
--version 1.11.2 \
150+
helm template \
151+
cilium \
152+
cilium/cilium \
153+
--version 1.13.0 \
84154
--namespace kube-system \
85-
--set ipam.mode=kubernetes > cilium.yaml
155+
--set ipam.mode=kubernetes \
156+
--set=kubeProxyReplacement=disabled \
157+
--set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
158+
--set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
159+
--set=cgroup.autoMount.enabled=false \
160+
--set=cgroup.hostRoot=/sys/fs/cgroup > cilium.yaml
86161

87162
kubectl apply -f cilium.yaml
88163
```
89164

90165
Without kube-proxy:
91166

92167
```bash
93-
export KUBERNETES_API_SERVER_ADDRESS=<>
168+
export KUBERNETES_API_SERVER_ADDRESS=<replace with api server endpoint here> # e.g. 10.96.0.1
94169
export KUBERNETES_API_SERVER_PORT=6443
95170

96-
helm template cilium cilium/cilium \
97-
--version 1.11.2 \
171+
helm template \
172+
cilium \
173+
cilium/cilium \
174+
--version 1.13.0 \
98175
--namespace kube-system \
99176
--set ipam.mode=kubernetes \
100-
--set kubeProxyReplacement=strict \
101-
--set k8sServiceHost="${KUBERNETES_API_SERVER_ADDRESS}" \
102-
--set k8sServicePort="${KUBERNETES_API_SERVER_PORT}" > cilium.yaml
177+
--set=kubeProxyReplacement=strict \
178+
--set=securityContext.capabilities.ciliumAgent="{CHOWN,KILL,NET_ADMIN,NET_RAW,IPC_LOCK,SYS_ADMIN,SYS_RESOURCE,DAC_OVERRIDE,FOWNER,SETGID,SETUID}" \
179+
--set=securityContext.capabilities.cleanCiliumState="{NET_ADMIN,SYS_ADMIN,SYS_RESOURCE}" \
180+
--set=cgroup.autoMount.enabled=false \
181+
--set=cgroup.hostRoot=/sys/fs/cgroup \
182+
--set=k8sServiceHost="${KUBERNETES_API_SERVER_ADDRESS}" \
183+
--set=k8sServicePort="${KUBERNETES_API_SERVER_PORT}" > cilium.yaml
103184

104185
kubectl apply -f cilium.yaml
105186
```
106187

107-
## Method 3: Helm manifests hosted install
188+
### Method 3: Helm manifests hosted install
108189

109190
After generating `cilium.yaml` using `helm template`, instead of applying this manifest directly during the Talos boot window (before the reboot timeout).
110191
You can also host this file somewhere and patch the machine config to apply this manifest automatically during bootstrap.
111192
To do this patch your machine configuration to include this config instead of the above:
112193

194+
Create a `patch.yaml` file with the following contents:
195+
196+
```yaml
197+
cluster:
198+
network:
199+
cni:
200+
name: custom
201+
urls:
202+
- https://server.yourdomain.tld/some/path/cilium.yaml
203+
```
204+
113205
```bash
114206
talosctl gen config \
115207
my-cluster https://mycluster.local:6443 \
116-
--config-patch '[{"op":"add", "path": "/cluster/network/cni", "value": {"name": "custom", "urls": ["https://server.yourdomain.tld/some/path/cilium.yaml"]}}]'
117-
```
118-
119-
Resulting in a config that look like this:
120-
121-
``` yaml
122-
name: custom # Name of CNI to use.
123-
# URLs containing manifests to apply for the CNI.
124-
urls:
125-
- https://server.yourdomain.tld/some/path/cilium.yaml
208+
--config-patch @patch.yaml
126209
```
127210

128211
However, beware of the fact that the helm generated Cilium manifest contains sensitive key material.
129212
As such you should definitely not host this somewhere publicly accessible.
130213

131-
## Method 4: Helm manifests inline install
214+
### Method 4: Helm manifests inline install
132215

133216
A more secure option would be to include the `helm template` output manifest inside the machine configuration.
134217
The machine config should be generated with CNI set to `none`
135218

219+
Create a `patch.yaml` file with the following contents:
220+
221+
```yaml
222+
cluster:
223+
network:
224+
cni:
225+
name: none
226+
```
227+
136228
```bash
137229
talosctl gen config \
138230
my-cluster https://mycluster.local:6443 \
139-
--config-patch '[{"op":"add", "path": "/cluster/network/cni", "value": {"name": "none"}}]'
231+
--config-patch @patch.yaml
140232
```
141233

142234
if deploying Cilium with `kube-proxy` disabled, you can also include the following:
143235

236+
Create a `patch.yaml` file with the following contents:
237+
238+
```yaml
239+
cluster:
240+
network:
241+
cni:
242+
name: none
243+
proxy:
244+
disabled: true
245+
```
246+
144247
```bash
145248
talosctl gen config \
146249
my-cluster https://mycluster.local:6443 \
147-
--config-patch '[{"op": "add", "path": "/cluster/proxy", "value": {"disabled": true}}, {"op":"add", "path": "/cluster/network/cni", "value": {"name": "none"}}]'
250+
--config-patch @patch.yaml
148251
```
149252

150253
To do so patch this into your machine configuration:
@@ -181,28 +284,12 @@ As the inline manifest is processed from top to bottom make sure to manually put
181284

182285
## Known issues
183286

184-
- Currently there is an interaction between a Kubespan enabled Talos cluster and Cilium that results in the cluster going down during bootstrap after applying the Cilium manifests.
185-
For more details: [Kubespan and Cilium compatiblity: etcd is failing](https://github.com/siderolabs/talos/issues/4836)
186-
187287
- There are some gotchas when using Talos and Cilium on the Google cloud platform when using internal load balancers.
188288
For more details: [GCP ILB support / support scope local routes to be configured](https://github.com/siderolabs/talos/issues/4109)
189289

190-
- Some kernel values changed by kube-proxy are not set to good defaults when running the cilium kernel-proxy alternative.
191-
For more details: [Kernel default values (sysctl)](https://github.com/siderolabs/talos/issues/4654)
192-
193290
## Other things to know
194291

195292
- Talos has full kernel module support for eBPF, See:
196-
- [Cilium System Requirements](https://docs.cilium.io/en/v1.11/operations/system_requirements/)
197-
- [Talos Kernel Config AMD64](https://github.com/talos-systems/pkgs/blob/master/kernel/build/config-amd64)
198-
- [Talos Kernel Config ARM64](https://github.com/talos-systems/pkgs/blob/master/kernel/build/config-arm64)
199-
200-
- Talos also includes the modules:
201-
202-
- `CONFIG_NETFILTER_XT_TARGET_TPROXY=m`
203-
- `CONFIG_NETFILTER_XT_TARGET_CT=m`
204-
- `CONFIG_NETFILTER_XT_MATCH_MARK=m`
205-
- `CONFIG_NETFILTER_XT_MATCH_SOCKET=m`
206-
207-
This allows you to set `--set enableXTSocketFallback=false` on the helm install/template command preventing Cilium from disabling the `ip_early_demux` kernel feature.
208-
This will win back some performance.
293+
- [Cilium System Requirements](https://docs.cilium.io/en/v1.13/operations/system_requirements/)
294+
- [Talos Kernel Config AMD64](https://github.com/siderolabs/pkgs/blob/main/kernel/build/config-amd64)
295+
- [Talos Kernel Config ARM64](https://github.com/siderolabs/pkgs/blob/main/kernel/build/config-arm64)

0 commit comments

Comments
 (0)