资源规划
名称 | ip | 资源配置 |
---|---|---|
master | 192.168.163.100 | 2c,2u,50g |
node1 | 192.168.163.101 | 2c,2u,50g |
node2 | 192.168.163.102 | 2c,2u,50g |
VMware 安装环境系统
系统 CentOS:CentOS-7-x86_64-DVD-1804.iso
先安装master,后面使用 VMware 的虚拟机复制,编辑 hostname 和 编辑 IP 配置。
编辑hostname: vim /etc/hostname
编辑ip:vim /etc/sysconfig/network-scripts/ifconfig-ens33
参考:VMware 如何通过现有虚拟机克隆新的虚拟机 (图文)
统一用户名 root,密码 123456(只是为了测试方便而已)
kubectl apply -f kube-flannel.yml 报错
不知道,怎么就好了,参考了一下 K8s 配置网络插件flannel
调整 kube-flannel.yml
net-conf.json: |
{
"Network": "10.244.0.0/16",
"Backend": {
"Type": "vxlan",
"Directrouting":true #新加
}
和 kubectl delete -f kube-flannel.yml
[root@master ~]# kubectl apply -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master NotReady master 2m35s v1.17.4
node1 NotReady <none> 110s v1.17.4
node2 NotReady <none> 106s v1.17.4
[root@master ~]# kubectl apply -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged configured
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 unchanged
[root@master ~]# vim kube-flannel.yml
[root@master ~]#
[root@master ~]#
[root@master ~]#
[root@master ~]# kubectl apply -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged configured
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 configured
[root@master ~]# vim kube-flannel.yml
[root@master ~]#
[root@master ~]# ip router show
Object "router" is unknown, try "ip help".
[root@master ~]# ip route show
default via 192.168.163.2 dev ens33 proto static metric 100
10.244.0.0/24 dev cni0 proto kernel scope link src 10.244.0.1
10.244.1.0/24 via 10.244.1.0 dev flannel.1 onlink
10.244.2.0/24 via 10.244.2.0 dev flannel.1 onlink
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.163.0/24 dev ens33 proto kernel scope link src 192.168.163.100 metric 100
[root@master ~]# ls -a
. .bash_history .bashrc .cshrc .pki
.. .bash_logout .cache .kube .tcshrc
anaconda-ks.cfg .bash_profile .config kube-flannel.yml .viminfo
[root@master ~]# ll -a
总用量 44
dr-xr-x---. 6 root root 229 6月 28 11:17 .
dr-xr-xr-x. 17 root root 224 6月 28 10:12 ..
-rw-------. 1 root root 1281 6月 28 10:12 anaconda-ks.cfg
-rw-------. 1 root root 2925 6月 28 11:01 .bash_history
-rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout
-rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile
-rw-r--r--. 1 root root 176 12月 29 2013 .bashrc
drwxr-xr-x. 3 root root 18 6月 28 10:16 .cache
drwxr-xr-x. 3 root root 18 6月 28 10:16 .config
-rw-r--r--. 1 root root 100 12月 29 2013 .cshrc
drwxr-xr-x 4 root root 51 6月 28 11:09 .kube
-rw-r--r-- 1 root root 4879 6月 28 11:24 kube-flannel.yml
drwxr----- 3 root root 19 6月 28 10:50 .pki
-rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
-rw------- 1 root root 5294 6月 28 11:17 .viminfo
[root@master ~]# kubectl apply -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged configured
clusterrole.rbac.authorization.k8s.io/flannel unchanged
clusterrolebinding.rbac.authorization.k8s.io/flannel unchanged
serviceaccount/flannel unchanged
configmap/kube-flannel-cfg configured
daemonset.apps/kube-flannel-ds unchanged
[root@master ~]# kubectl delete -f kube-flannel.yml
podsecuritypolicy.policy "psp.flannel.unprivileged" deleted
clusterrole.rbac.authorization.k8s.io "flannel" deleted
clusterrolebinding.rbac.authorization.k8s.io "flannel" deleted
serviceaccount "flannel" deleted
configmap "kube-flannel-cfg" deleted
daemonset.apps "kube-flannel-ds" deleted
[root@master ~]# kubectl apply -f kube-flannel.yml
podsecuritypolicy.policy/psp.flannel.unprivileged created
clusterrole.rbac.authorization.k8s.io/flannel created
clusterrolebinding.rbac.authorization.k8s.io/flannel created
serviceaccount/flannel created
configmap/kube-flannel-cfg created
daemonset.apps/kube-flannel-ds created
[root@master ~]# kubeadm get nodes
unknown command "get" for "kubeadm"
To see the stack trace of this error execute with --v=5 or higher
[root@master ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready master 17m v1.17.4
node1 Ready <none> 17m v1.17.4
node2 Ready <none> 17m v1.17.4