最近更新时间:2023.06.27 11:50:48
首次发布时间:2022.05.09 17:53:42
CoreDNS 组件当前不支持在控制台上使用 VCI 部署。您可以通过修改名为 coredns 的 Deployment(无状态负载),实现使用 VCI 部署 CoreDNS。
操作步骤如下:
...
> 编辑 Yaml。spec
> template
> metadata
参数下,增加如下annotations
字段,将无状态负载强制调度到 VCI。代码片段示意图如下:annotations: vke.volcengine.com/burst-to-vci: enforce # 强制调度到 VCI
spec
> template
> spec
参数下,增加如下dnsConfig
字段,指定 dnsConfig 到 IaaS DNS。代码片段示意图如下:dnsConfig: # 修改 dnsConfig 到 IaaS DNS nameservers: - 100.96.0.2 - 100.96.0.3 options: - name: rotate
spec
> template
> spec
参数下dnsPolicy
字段的值为 None。apiVersion: apps/v1 kind: Deployment metadata: labels: k8s-app: kube-dns name: coredns namespace: kube-system spec: progressDeadlineSeconds: 600 replicas: 2 revisionHistoryLimit: 10 selector: matchLabels: k8s-app: kube-dns strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 1 type: RollingUpdate template: metadata: annotations: vke.volcengine.com/burst-to-vci: enforce # 强制调度到 VCI creationTimestamp: null labels: k8s-app: kube-dns spec: containers: - args: - -conf - /etc/coredns/Corefile image: cr-cn-beijing.ivolces.com/vke/coredns:1.7.0 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 name: coredns ports: - containerPort: 53 protocol: UDP - containerPort: 53 protocol: TCP - containerPort: 9153 protocol: TCP readinessProbe: failureThreshold: 3 httpGet: path: /ready port: 8181 scheme: HTTP periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 resources: limits: memory: 770Mi requests: cpu: 100m memory: 70Mi terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /etc/coredns name: config-volume readOnly: true dnsConfig: # 修改 dnsConfig 到 IaaS DNS nameservers: - 100.96.0.2 - 100.96.0.3 options: - name: rotate dnsPolicy: None nodeSelector: kubernetes.io/os: linux node.kubernetes.io/instance-type: virtual-node priorityClassName: system-cluster-critical restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: coredns serviceAccountName: coredns terminationGracePeriodSeconds: 30 tolerations: - key: CriticalAddonsOnly operator: Exists - effect: NoSchedule key: node-role.kubernetes.io/master - effect: NoSchedule key: node-role.kubernetes.io/control-plane - effect: NoSchedule key: vci.vke.volcengine.com/node-type operator: Equal value: vci volumes: - configMap: defaultMode: 420 items: - key: Corefile path: Corefile name: coredns name: config-volume