2.2. 配置 IPv6 单堆栈网络
您可以通过更新 MicroShift 服务配置文件来使用 IPv6 网络协议。
先决条件
-
已安装 OpenShift CLI(
oc
)。 - 有对集群的 root 访问权限。
- 集群使用 OVN-Kubernetes 网络插件。
- 主机具有 IPv6 地址和 IPv6 路由,包括默认值。
流程
-
如果您还没有这样做,请在
/etc/microshift/
目录中生成提供的config.yaml.default
文件的副本,将它重命名为config.yaml
。 将新的 MicroShift
config.yaml
保留在/etc/microshift/
目录中。MicroShift 服务每次启动时都会读取config.yaml
文件。注意创建后,
config.yaml
文件优先于内置设置。将 MicroShift YAML 的
network
部分中的默认值替换为您的有效值。单堆栈 IPv6 网络配置示例
apiServer: # ... network: clusterNetwork: - fd01::/48 1 serviceNetwork: - fd02::/112 2 node: nodeIP: 2600:1f14:1c48:ee00:2d76:3190:5bc2:5aef 3 # ...
运行以下命令完成任何其他配置,然后启动 MicroShift:
$ sudo systemctl start microshift
验证
运行以下命令,检索节点资源中定义的网络:
$ oc get node -o jsonpath='{.items[].spec.podCIDRs[]}'
输出示例
fd01::/48
运行以下命令,检索 pod 的状态:
$ oc get pod -A -o wide
输出示例
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES kube-system csi-snapshot-controller-bb7cb654b-rqrt6 1/1 Running 0 65s fd01:0:0:1::5 microshift-9 <none> <none> kube-system csi-snapshot-webhook-95f475949-nbz8x 1/1 Running 0 61s fd01:0:0:1::6 microshift-9 <none> <none> openshift-dns dns-default-cjn66 2/2 Running 0 62s fd01:0:0:1::9 microshift-9 <none> <none> openshift-dns node-resolver-ppnjb 1/1 Running 0 63s 2001:db9:ca7:ff::1db8 microshift-9 <none> <none> openshift-ingress router-default-6d97d7b8b6-wdtmg 1/1 Running 0 61s fd01:0:0:1::8 microshift-9 <none> <none> openshift-ovn-kubernetes ovnkube-master-gfvp5 4/4 Running 0 63s 2001:db9:ca7:ff::1db8 microshift-9 <none> <none> openshift-ovn-kubernetes ovnkube-node-bnpjh 1/1 Running 0 63s 2001:db9:ca7:ff::1db8 microshift-9 <none> <none> openshift-service-ca service-ca-5d7bd9db6-j25bd 1/1 Running 0 60s fd01:0:0:1::4 microshift-9 <none> <none> openshift-storage lvms-operator-656cd9b59b-bwr47 1/1 Running 0 63s fd01:0:0:1::7 microshift-9 <none> <none> openshift-storage vg-manager-f7dmk 1/1 Running 0 27s fd01:0:0:1::a microshift-9 <none> <none>
运行以下命令来检索服务的状态:
$ oc get svc -A
输出示例
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE default kubernetes ClusterIP fd02::1 <none> 443/TCP 3m42s kube-system csi-snapshot-webhook ClusterIP fd02::4c4f <none> 443/TCP 3m20s openshift-dns dns-default ClusterIP fd02::a <none> 53/UDP,53/TCP,9154/TCP 2m58s openshift-ingress router-default LoadBalancer fd02::f2e6 2001:db9:ca7:ff::1db8,fd01:0:0:1::2,fd02::1:0,fd69::2 80:31133/TCP,443:31996/TCP 2m58s openshift-ingress router-internal-default ClusterIP fd02::c55e <none> 80/TCP,443/TCP,1936/TCP 2m58s openshift-storage lvms-operator-metrics-service ClusterIP fd02::7afb <none> 443/TCP 2m58s openshift-storage lvms-webhook-service ClusterIP fd02::d8dd <none> 443/TCP 2m58s openshift-storage vg-manager-metrics-service ClusterIP fd02::fc1 <none> 443/TCP 2m58s