Created
March 7, 2024 00:00
-
-
Save juztas/125817f4c791872017bab345badef873 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Note: | |
| # This deployment file is designed for 'quickstart' of multus, easy installation to test it, | |
| # hence this deployment yaml does not care about following things intentionally. | |
| # - various configuration options | |
| # - minor deployment scenario | |
| # - upgrade/update/uninstall scenario | |
| # Multus team understand users deployment scenarios are diverse, hence we do not cover | |
| # comprehensive deployment scenario. We expect that it is covered by each platform deployment. | |
| --- | |
| apiVersion: apiextensions.k8s.io/v1 | |
| kind: CustomResourceDefinition | |
| metadata: | |
| name: network-attachment-definitions.k8s.cni.cncf.io | |
| spec: | |
| group: k8s.cni.cncf.io | |
| scope: Namespaced | |
| names: | |
| plural: network-attachment-definitions | |
| singular: network-attachment-definition | |
| kind: NetworkAttachmentDefinition | |
| shortNames: | |
| - net-attach-def | |
| versions: | |
| - name: v1 | |
| served: true | |
| storage: true | |
| schema: | |
| openAPIV3Schema: | |
| description: 'NetworkAttachmentDefinition is a CRD schema specified by the Network Plumbing | |
| Working Group to express the intent for attaching pods to one or more logical or physical | |
| networks. More information available at: https://github.com/k8snetworkplumbingwg/multi-net-spec' | |
| type: object | |
| properties: | |
| apiVersion: | |
| description: 'APIVersion defines the versioned schema of this represen | |
| tation of an object. Servers should convert recognized schemas to the | |
| latest internal value, and may reject unrecognized values. More info: | |
| https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | |
| type: string | |
| kind: | |
| description: 'Kind is a string value representing the REST resource this | |
| object represents. Servers may infer this from the endpoint the client | |
| submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | |
| type: string | |
| metadata: | |
| type: object | |
| spec: | |
| description: 'NetworkAttachmentDefinition spec defines the desired state of a network attachment' | |
| type: object | |
| properties: | |
| config: | |
| description: 'NetworkAttachmentDefinition config is a JSON-formatted CNI configuration' | |
| type: string | |
| --- | |
| 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 | |
| - update | |
| - apiGroups: | |
| - "" | |
| - events.k8s.io | |
| resources: | |
| - events | |
| verbs: | |
| - create | |
| - patch | |
| - update | |
| --- | |
| 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 | |
| --- | |
| apiVersion: v1 | |
| kind: ServiceAccount | |
| metadata: | |
| name: multus | |
| namespace: kube-system | |
| --- | |
| kind: ConfigMap | |
| apiVersion: v1 | |
| metadata: | |
| name: multus-daemon-config | |
| namespace: kube-system | |
| labels: | |
| tier: node | |
| app: multus | |
| data: | |
| daemon-config.json: | | |
| { | |
| "chrootDir": "/hostroot", | |
| "confDir": "/host/etc/cni/net.d", | |
| "logToStderr": true, | |
| "logLevel": "verbose", | |
| "logFile": "/tmp/multus.log", | |
| "binDir": "/opt/cni/bin", | |
| "cniDir": "/var/lib/cni/multus", | |
| "socketDir": "/host/run/multus/", | |
| "cniVersion": "0.3.1", | |
| "cniConfigDir": "/host/etc/cni/net.d", | |
| "multusConfigFile": "auto", | |
| "multusAutoconfigDir": "/host/etc/cni/net.d" | |
| } | |
| --- | |
| apiVersion: v1 | |
| data: | |
| record-start.sh: | | |
| #!/bin/bash | |
| st_time=`cat /proc/stat | grep btime | awk '{ print substr($2, 1, length($2)-1) "0"}'`; | |
| echo $st_time > /tmp/multus-cni-started; | |
| check-liveness.sh: | | |
| #!/bin/bash | |
| st_time=`cat /proc/stat | grep btime | awk '{ print substr($2, 1, length($2)-1) "0"}'`; | |
| diff <(cat /tmp/multus-cni-started) <(echo $st_time) &> /dev/null | |
| retVal=$? | |
| if [ $retVal -ne 0 ]; then | |
| sleep 60 # We sleep 60seconds to allow calico restart first. | |
| echo "Machine was rebooted. We need to restart container." | |
| exit 1 | |
| fi | |
| kind: ConfigMap | |
| metadata: | |
| name: kube-multus-auto-restart | |
| namespace: kube-system | |
| --- | |
| 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:v4.0.2-thick | |
| command: [ "/usr/src/multus-cni/bin/multus-daemon" ] | |
| resources: | |
| requests: | |
| cpu: "100m" | |
| memory: "50Mi" | |
| limits: | |
| cpu: "100m" | |
| memory: "50Mi" | |
| securityContext: | |
| privileged: true | |
| lifecycle: | |
| postStart: | |
| exec: | |
| command: | |
| - bash | |
| - /etc/kube-multus-auto-restart/record-start.sh | |
| livenessProbe: | |
| exec: | |
| command: | |
| - bash | |
| - /etc/kube-multus-auto-restart/check-liveness.sh | |
| initialDelaySeconds: 5 | |
| periodSeconds: 5 | |
| volumeMounts: | |
| - name: cni | |
| mountPath: /host/etc/cni/net.d | |
| - 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 | |
| - name: host-run-k8s-cni-cncf-io | |
| mountPath: /run/k8s.cni.cncf.io | |
| - name: host-run-netns | |
| mountPath: /run/netns | |
| mountPropagation: HostToContainer | |
| - name: multus-daemon-config | |
| mountPath: /etc/cni/net.d/multus.d | |
| readOnly: true | |
| - mountPath: /etc/kube-multus-auto-restart/ | |
| name: multus-auto-restart | |
| - name: hostroot | |
| mountPath: /hostroot | |
| mountPropagation: HostToContainer | |
| initContainers: | |
| - name: install-multus-binary | |
| image: ghcr.io/k8snetworkplumbingwg/multus-cni:v4.0.2-thick | |
| command: | |
| - "cp" | |
| - "/usr/src/multus-cni/bin/multus-shim" | |
| - "/host/opt/cni/bin/multus-shim" | |
| resources: | |
| requests: | |
| cpu: "10m" | |
| memory: "15Mi" | |
| securityContext: | |
| privileged: true | |
| volumeMounts: | |
| - name: cnibin | |
| mountPath: /host/opt/cni/bin | |
| mountPropagation: Bidirectional | |
| - args: | |
| - /host/run/multus-cni-started | |
| command: | |
| - touch | |
| resources: | |
| requests: | |
| cpu: "10m" | |
| memory: "15Mi" | |
| image: ghcr.io/k8snetworkplumbingwg/multus-cni:v4.0.2-thick | |
| name: service-started-touch-file | |
| volumeMounts: | |
| - name: host-run | |
| mountPath: /host/run | |
| 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 | |
| - configMap: | |
| name: kube-multus-auto-restart | |
| defaultMode: 0777 | |
| name: multus-auto-restart | |
| - 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/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment