add multus CNI
This commit is contained in:
29
system-apps/multus/clusterrole.yaml
Normal file
29
system-apps/multus/clusterrole.yaml
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
kind: ClusterRole
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: multus
|
||||||
|
rules:
|
||||||
|
- apiGroups: ["k8s.cni.cncf.io"]
|
||||||
|
resources:
|
||||||
|
- '*'
|
||||||
|
verbs:
|
||||||
|
- '*'
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- pods
|
||||||
|
- pods/status
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
- events.k8s.io
|
||||||
|
resources:
|
||||||
|
- events
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
12
system-apps/multus/clusterrolebinding.yaml
Normal file
12
system-apps/multus/clusterrolebinding.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
kind: ClusterRoleBinding
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
metadata:
|
||||||
|
name: multus
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: multus
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: multus
|
||||||
|
namespace: kube-system
|
||||||
20
system-apps/multus/configmap.yaml
Normal file
20
system-apps/multus/configmap.yaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
kind: ConfigMap
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: multus-daemon-config
|
||||||
|
namespace: kube-system
|
||||||
|
labels:
|
||||||
|
tier: node
|
||||||
|
app: multus
|
||||||
|
data:
|
||||||
|
daemon-config.json: |
|
||||||
|
{
|
||||||
|
"chrootDir": "/hostroot",
|
||||||
|
"cniVersion": "0.3.1",
|
||||||
|
"logLevel": "verbose",
|
||||||
|
"logToStderr": true,
|
||||||
|
"cniConfigDir": "/host/etc/cni/net.d",
|
||||||
|
"multusAutoconfigDir": "/host/etc/cni/net.d",
|
||||||
|
"multusConfigFile": "auto",
|
||||||
|
"socketDir": "/host/run/multus/"
|
||||||
|
}
|
||||||
0
system-apps/multus/crd.yaml
Normal file
0
system-apps/multus/crd.yaml
Normal file
132
system-apps/multus/daemonset.yaml
Normal file
132
system-apps/multus/daemonset.yaml
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: DaemonSet
|
||||||
|
metadata:
|
||||||
|
name: kube-multus-ds
|
||||||
|
namespace: kube-system
|
||||||
|
labels:
|
||||||
|
tier: node
|
||||||
|
app: multus
|
||||||
|
name: multus
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
name: multus
|
||||||
|
updateStrategy:
|
||||||
|
type: RollingUpdate
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
tier: node
|
||||||
|
app: multus
|
||||||
|
name: multus
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
hostPID: true
|
||||||
|
tolerations:
|
||||||
|
- operator: Exists
|
||||||
|
effect: NoSchedule
|
||||||
|
- operator: Exists
|
||||||
|
effect: NoExecute
|
||||||
|
serviceAccountName: multus
|
||||||
|
containers:
|
||||||
|
- name: kube-multus
|
||||||
|
image: ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick
|
||||||
|
command: [ "/usr/src/multus-cni/bin/multus-daemon" ]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "100m"
|
||||||
|
memory: "50Mi"
|
||||||
|
limits:
|
||||||
|
cpu: "100m"
|
||||||
|
memory: "50Mi"
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
terminationMessagePolicy: FallbackToLogsOnError
|
||||||
|
volumeMounts:
|
||||||
|
- name: cni
|
||||||
|
mountPath: /host/etc/cni/net.d
|
||||||
|
# multus-daemon expects that cnibin path must be identical between pod and container host.
|
||||||
|
# e.g. if the cni bin is in '/opt/cni/bin' on the container host side, then it should be mount to '/opt/cni/bin' in multus-daemon,
|
||||||
|
# not to any other directory, like '/opt/bin' or '/usr/bin'.
|
||||||
|
- name: cnibin
|
||||||
|
mountPath: /opt/cni/bin
|
||||||
|
- name: host-run
|
||||||
|
mountPath: /host/run
|
||||||
|
- name: host-var-lib-cni-multus
|
||||||
|
mountPath: /var/lib/cni/multus
|
||||||
|
- name: host-var-lib-kubelet
|
||||||
|
mountPath: /var/lib/kubelet
|
||||||
|
mountPropagation: HostToContainer
|
||||||
|
- name: host-run-k8s-cni-cncf-io
|
||||||
|
mountPath: /run/k8s.cni.cncf.io
|
||||||
|
- name: host-run-netns
|
||||||
|
mountPath: /var/run/netns # https://www.talos.dev/v1.10/kubernetes-guides/network/multus/#patching-the-daemonset
|
||||||
|
mountPropagation: HostToContainer
|
||||||
|
- name: multus-daemon-config
|
||||||
|
mountPath: /etc/cni/net.d/multus.d
|
||||||
|
readOnly: true
|
||||||
|
- name: hostroot
|
||||||
|
mountPath: /hostroot
|
||||||
|
mountPropagation: HostToContainer
|
||||||
|
- mountPath: /etc/cni/multus/net.d
|
||||||
|
name: multus-conf-dir
|
||||||
|
env:
|
||||||
|
- name: MULTUS_NODE_NAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
fieldPath: spec.nodeName
|
||||||
|
initContainers:
|
||||||
|
- name: install-multus-binary
|
||||||
|
image: ghcr.io/k8snetworkplumbingwg/multus-cni:snapshot-thick
|
||||||
|
command: # https://www.talos.dev/v1.10/kubernetes-guides/network/multus/#patching-the-daemonset
|
||||||
|
- "/usr/src/multus-cni/bin/install_multus"
|
||||||
|
- "-d"
|
||||||
|
- "/host/opt/cni/bin"
|
||||||
|
- "-t"
|
||||||
|
- "thick"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: "10m"
|
||||||
|
memory: "15Mi"
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
terminationMessagePolicy: FallbackToLogsOnError
|
||||||
|
volumeMounts:
|
||||||
|
- name: cnibin
|
||||||
|
mountPath: /host/opt/cni/bin
|
||||||
|
mountPropagation: Bidirectional
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
volumes:
|
||||||
|
- name: cni
|
||||||
|
hostPath:
|
||||||
|
path: /etc/cni/net.d
|
||||||
|
- name: cnibin
|
||||||
|
hostPath:
|
||||||
|
path: /opt/cni/bin
|
||||||
|
- name: hostroot
|
||||||
|
hostPath:
|
||||||
|
path: /
|
||||||
|
- name: multus-daemon-config
|
||||||
|
configMap:
|
||||||
|
name: multus-daemon-config
|
||||||
|
items:
|
||||||
|
- key: daemon-config.json
|
||||||
|
path: daemon-config.json
|
||||||
|
- name: host-run
|
||||||
|
hostPath:
|
||||||
|
path: /run
|
||||||
|
- name: host-var-lib-cni-multus
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/cni/multus
|
||||||
|
- name: host-var-lib-kubelet
|
||||||
|
hostPath:
|
||||||
|
path: /var/lib/kubelet
|
||||||
|
- name: host-run-k8s-cni-cncf-io
|
||||||
|
hostPath:
|
||||||
|
path: /run/k8s.cni.cncf.io
|
||||||
|
- name: host-run-netns
|
||||||
|
hostPath:
|
||||||
|
path: /run/netns/
|
||||||
|
- name: multus-conf-dir
|
||||||
|
hostPath:
|
||||||
|
path: /etc/cni/multus/net.d
|
||||||
5
system-apps/multus/serviceaccount.yaml
Normal file
5
system-apps/multus/serviceaccount.yaml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
name: multus
|
||||||
|
namespace: kube-system
|
||||||
Reference in New Issue
Block a user