1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
| [root@k8s-master01 ~]# echo 'KUBELET_EXTRA_ARGS="--node-ip=192.168.1.21,fc00::21"' > /etc/sysconfig/kubelet [root@k8s-master01 ~]# systemctl daemon-reload && systemctl restart kubelet
[root@k8s-node01 ~]# echo 'KUBELET_EXTRA_ARGS="--node-ip=192.168.1.22,fc00::22"' > /etc/sysconfig/kubelet [root@k8s-node01 ~]# systemctl daemon-reload && systemctl restart kubelet
[root@k8s-node02 ~]# echo 'KUBELET_EXTRA_ARGS="--node-ip=192.168.1.23,fc00::23"' > /etc/sysconfig/kubelet [root@k8s-node02 ~]# systemctl daemon-reload && systemctl restart kubelet
cat<<EOF | kubectl apply -f - apiVersion: apps/v1 kind: Deployment metadata: name: chenby spec: replicas: 1 selector: matchLabels: app: chenby template: metadata: labels: app: chenby spec: hostNetwork: true containers: - name: chenby image: docker.io/library/nginx resources: limits: memory: "128Mi" cpu: "500m" ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: chenby spec: ipFamilyPolicy: PreferDualStack ipFamilies: - IPv6 - IPv4 type: NodePort selector: app: chenby ports: - port: 80 targetPort: 80 EOF
#查看端口 [root@k8s-master01 ~]# kubectl get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE chenby NodePort fd00:1111::a:2aaa <none> 80:30249/TCP 10s kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 9m56s [root@k8s-master01 ~]# [root@k8s-master01 ~]# curl -I http://[fd00:1111::a:2aaa] HTTP/1.1 200 OK Server: nginx/1.31.6 Date: Tue, 29 Sep 2026 09:05:19 GMT Content-Type: text/html Content-Length: 896 Last-Modified: Tue, 15 Sep 2026 12:54:15 GMT Connection: keep-alive ETag: "6aa93ff7-380" Accept-Ranges: bytes
[root@k8s-master01 ~]# [root@k8s-master01 ~]# curl -I http://192.168.1.21:30249 HTTP/1.1 200 OK Server: nginx/1.31.6 Date: Tue, 29 Sep 2026 09:05:24 GMT Content-Type: text/html Content-Length: 896 Last-Modified: Tue, 15 Sep 2026 12:54:15 GMT Connection: keep-alive ETag: "6aa93ff7-380" Accept-Ranges: bytes
[root@k8s-master01 ~]# [root@k8s-master01 ~]# curl -I http://[fc00::21]:30249 HTTP/1.1 200 OK Server: nginx/1.31.6 Date: Tue, 29 Sep 2026 09:05:31 GMT Content-Type: text/html Content-Length: 896 Last-Modified: Tue, 15 Sep 2026 12:54:15 GMT Connection: keep-alive ETag: "6aa93ff7-380" Accept-Ranges: bytes
[root@k8s-master01 ~]# [root@k8s-master01 ~]# curl -I http://[2409:8a10:6d7:b511:c46e:8678:944d:3ddb]:30249 HTTP/1.1 200 OK Server: nginx/1.31.6 Date: Tue, 29 Sep 2026 09:05:39 GMT Content-Type: text/html Content-Length: 896 Last-Modified: Tue, 15 Sep 2026 12:54:15 GMT Connection: keep-alive ETag: "6aa93ff7-380" Accept-Ranges: bytes
[root@k8s-master01 ~]#
|