通过 Kubenetes POD 在主机上创建 OVS 桥

通过 Kubenetes POD 在主机上创建 OVS 桥

我创建了一个守护进程:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-ovs
  namespace: kube-system
  labels:
    app: ovs
spec:
  selector:
    matchLabels:
      name: kube-ovs
  template:
    metadata:
      labels:
        name: kube-ovs
    spec:
      hostNetwork: true
      containers:
      - name: ovs
        securityContext:
          privileged: true
        image: openvswitch/ovs:2.11.2_debian
        command: ["start-ovs"]
        args:
        - ovsdb-server
        - --detach
        - ovs-vsctl
        - --no-wait
        - init &&
        - ovs-vswitchd
        volumeMounts:
        - name: ovs
          mountPath: /var/run/openvswitch
        - name: kernel-modules
          mountPath: /lib/modules/5.4.0-88-generic
      # terminationGracePeriodSeconds: 30
      volumes:
      - name: kernel-modules
        hostPath:
          path: /lib/modules/5.4.0-88-generic
      - name: ovs
        hostPath:
          path: /var/run/openvswitch

我需要在主机(Kubernetes 节点)上创建 OVS 桥。我无法访问操作系统来安装开放开关。但Kubernetes运行在特权模式下,可以通过容器访问主机。

是否可以?

相关内容