kubernetes v1.18.2 部署flannel

2021-03-10 21:30

阅读:518

标签:yam   eth0   request   pac   star   amd   第一个   context   应用   

创建flannel yaml
cat 

部署 flannel

 kubectl apply -f yaml/kube-flannel.yaml
 # 我已经不过了
 root@Qist:/mnt/g/work/ipv6/1# kubectl apply -f yaml/kube-flannel.yaml
clusterrole.rbac.authorization.k8s.io/flannel unchanged
clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged
serviceaccount/flannel unchanged
configmap/kube-flannel-cfg unchanged
daemonset.apps/kube-flannel-ds-amd64 unchanged
# 查看 flannel 是否部署成功
root@Qist:/mnt/g/work/ipv6/1# kubectl get node
NAME           STATUS   ROLES    AGE   VERSION
k8s-master-1   Ready       13h   v1.18.2
k8s-master-2   Ready       13h   v1.18.2
k8s-master-3   Ready       13h   v1.18.2
k8s-node-1     Ready       13h   v1.18.2
k8s-node-2     Ready       13h   v1.18.2
[root@k8s-master-1 conf]# ip a| grep flannel
4: flannel.1:  mtu 1450 qdisc noqueue state UNKNOWN group default
    inet 10.80.0.0/32 scope global flannel.1
[root@k8s-master-1 conf]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.2     0.0.0.0         UG    100    0        0 eth0
10.80.1.0       192.168.2.176   255.255.255.0   UG    0      0        0 eth0
10.80.2.0       192.168.2.177   255.255.255.0   UG    0      0        0 eth0
10.80.3.0       192.168.2.187   255.255.255.0   UG    0      0        0 eth0
10.80.4.0       192.168.2.185   255.255.255.0   UG    0      0        0 eth0
192.168.2.0     0.0.0.0         255.255.254.0   U     100    0        0 eth0

部署第一个应用pod 网络是否正常

kubectl create deployment myip --image=cloudnativelabs/whats-my-ip
kubectl expose deployment myip --port=8080 --target-port=8080
root@Qist:/tmp/sss# kubectl get pod
NAME                    READY   STATUS    RESTARTS   AGE
myip-75c9c47c7f-b8dv8   1/1     Running   0          11m
root@Qist:/tmp/sss# kubectl get svc
NAME         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
kubernetes   ClusterIP   10.66.0.1               443/TCP    34m
myip         ClusterIP   10.66.147.150           8080/TCP   14s
# 登陆任意节点访问service ip
root@k8s-master-1 conf]# curl 10.66.147.150:8080
HOSTNAME:myip-75c9c47c7f-b8dv8 IP:10.80.4.2
[root@k8s-master-1 conf]# curl 10.80.4.2:8080
HOSTNAME:myip-75c9c47c7f-b8dv8 IP:10.80.4.2
# 网络插件部署正常

kubernetes v1.18.2 部署flannel

标签:yam   eth0   request   pac   star   amd   第一个   context   应用   

原文地址:https://blog.51cto.com/juestnow/2493028


评论


亲,登录后才可以留言!