我正在尝试通过Vagrantfile使用CoreOS,K8和helm设置1个主节点。以下是主节点的ifconfig
:
core@master ~ $ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fee3:840a prefixlen 64 scopeid 0x20<link>
ether 08:00:27:e3:84:0a txqueuelen 1000 (Ethernet)
RX packets 15090 bytes 16105869 (15.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5974 bytes 655332 (639.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
core@master ~ $ ifconfig eth1
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.8.101 netmask 255.255.255.0 broadcast 172.17.8.255
inet6 fe80::a00:27ff:fe71:3a7f prefixlen 64 scopeid 0x20<link>
ether 08:00:27:71:3a:7f txqueuelen 1000 (Ethernet)
RX packets 488367 bytes 692553861 (660.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 82177 bytes 12772872 (12.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
VM启动,但选择eth0而不是eth1 IP,这会中断Internet连接,并且其他Pod处于挂起状态:
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE
ingress-nginx default-http-backend-5c6d95c48-vgkkr 0/1 Pending 0 29m <none> <none>
ingress-nginx nginx-ingress-controller-74ff96f786-kn4m8 0/1 Pending 0 29m <none> <none>
kube-system calico-node-2bpwm 0/2 ImagePullBackOff 0 29m 10.0.2.15 master.cluster.local
kube-system coredns-794cc4cddd-f5r5f 0/1 Pending 0 29m <none> <none>
kube-system coredns-794cc4cddd-hms5j 0/1 Pending 0 29m <none> <none>
kube-system kube-apiserver-master.cluster.local 1/1 Running 0 29m 10.0.2.15 master.cluster.local
kube-system kube-controller-manager-master.cluster.local 1/1 Running 0 29m 10.0.2.15 master.cluster.local
kube-system kube-proxy-master.cluster.local 1/1 Running 0 29m 10.0.2.15 master.cluster.local
kube-system kube-scheduler-master.cluster.local 1/1 Running 0 29m 10.0.2.15 master.cluster.local
kube-system kubernetes-dashboard-558b58cd8b-lqrv5 0/1 Pending 0 29m <none> <none>
kube-system kubernetes-dashboard-proxy-97566bfd6-qx2jk 0/1 Pending 0 29m <none> <none>
kube-system tiller-deploy-5c688d5f9b-z2l2c 0/1 Pending 0 29m <none> <none>
我尝试添加--node-port=172.17.8.101
,但没有帮助。
kubelet和api-server的Docker日志正在侦听172.17.8.101
删除--network-plugin=cni
无济于事
- name: kube-kubelet.service
command: start
content: |
[Unit]
Description=Kubernetes Kubelet
Documentation=https://github.com/GoogleCloudPlatform/kubernetes
Requires=kube-certs.service
Wants=hyperkube-download.service hyperkube-import.service
After=kube-certs.service hyperkube-download.service hyperkube-import.service
[Service]
ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests
ExecStartPre=-/usr/bin/docker rm -f kubelet
ExecStart=/usr/bin/docker run \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:ro \
--volume=/etc/cni/net.d:/etc/cni/net.d:rw \
--volume=/opt/cni/bin:/opt/cni/bin:rw \
--volume=/etc/kubernetes:/etc/kubernetes:ro \
--volume=/var/lib/calico/:/var/lib/calico:rw \
--volume=/var/lib/docker/:/var/lib/docker:rw \
--volume=/var/lib/kubelet/:/var/lib/kubelet:shared \
--volume=/var/run:/var/run:rw \
--net=host \
--pid=host \
--privileged=true \
--name=kubelet \
-d \
gcr.io/google_containers/hyperkube-amd64:__RELEASE__ \
/hyperkube kubelet \
--containerized \
--address=172.17.8.101 \
--register-schedulable=true \
--allow-privileged=true \
--pod-manifest-path=/etc/kubernetes/manifests \
--hostname-override=__NAME__.__DNS_DOMAIN__ \
--cluster_dns=192.168.2.10 \
--cluster_domain=__DNS_DOMAIN__ \
--kubeconfig=/etc/kubernetes/master-kubeconfig.yaml \
--network-plugin=cni \
--pod-cidr=__CLUSTER_CIDR__
Restart=on-failure
RestartSec=10
WorkingDirectory=/root/
[Install]
WantedBy=multi-user.target
需要帮助使k8s主节点在eth1(仅主机)而不是eth0(NAT)上运行。