Skip to content

Instantly share code, notes, and snippets.

@reski-rukmantiyo
Created May 5, 2024 02:57
Show Gist options
  • Save reski-rukmantiyo/1c5bb7da43bf91f4865e7c701c6fd230 to your computer and use it in GitHub Desktop.
Save reski-rukmantiyo/1c5bb7da43bf91f4865e7c701c6fd230 to your computer and use it in GitHub Desktop.
Install CNI daemonset
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: cni-installer
namespace: kube-system
spec:
selector:
matchLabels:
name: cni-installer
template:
metadata:
labels:
name: cni-installer
spec:
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "node-role.kubernetes.io/master"
operator: "DoesNotExist"
initContainers:
- name: install-cni
image: busybox
command: ["/bin/sh", "-c"]
args:
- >
wget -O /tmp/cni-plugins.tgz https://github.com/containernetworking/plugins/releases/download/v1.4.1/cni-plugins-linux-amd64-v1.4.1.tgz &&
tar -xzf /tmp/cni-plugins.tgz -C /host/opt/cni/bin && ls -alh /host/opt/cni/bin;
volumeMounts:
- name: cni-bin-dir
mountPath: /host/opt/cni/bin
containers:
- name: pause
image: k8s.gcr.io/pause:3.1
volumes:
- name: cni-bin-dir
hostPath:
path: /opt/cni/bin
type: DirectoryOrCreate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment