5.配置pod網絡node
5.1下載calico 網絡配置文件python
[root@k8s-1 libj]# curl -O https://docs.projectcalico.org/v3.6/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 19533 100 19533 0 0 9207 0 0:00:02 0:00:02 --:--:-- 9204 [root@k8s-1 libj]# ls calico.yaml kubeadm.yaml [root@k8s-1 libj]# vim calico.yaml
5.2直接建立calico網絡vim
[root@k8s-1 libj]# kubectl apply -f calico.yaml configmap/calico-config created customresourcedefinition.apiextensions.k8s.io/felixconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamblocks.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/blockaffinities.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamhandles.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ipamconfigs.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/bgppeers.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/bgpconfigurations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/ippools.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/hostendpoints.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/clusterinformations.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworkpolicies.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/globalnetworksets.crd.projectcalico.org created customresourcedefinition.apiextensions.k8s.io/networkpolicies.crd.projectcalico.org created clusterrole.rbac.authorization.k8s.io/calico-kube-controllers created clusterrolebinding.rbac.authorization.k8s.io/calico-kube-controllers created clusterrole.rbac.authorization.k8s.io/calico-node created clusterrolebinding.rbac.authorization.k8s.io/calico-node created daemonset.extensions/calico-node created serviceaccount/calico-node created deployment.extensions/calico-kube-controllers created serviceaccount/calico-kube-controllers created 建立完成後查看狀態
[root@k8s-1 libj]# kubectl get node NAME STATUS ROLES AGE VERSION k8s-1 Ready master 133m v1.15.3 [root@k8s-1 libj]# kubectl get pods No resources found. [root@k8s-1 libj]# kubectl get pods --all-namespaces NAMESPACE NAME READY STATUS RESTARTS AGE kube-system calico-kube-controllers-7b4657785d-fhxrz 0/1 ContainerCreating 0 109s kube-system calico-node-pwshp 1/1 Running 0 109s kube-system coredns-bccdc95cf-d58fh 1/1 Running 0 133m kube-system coredns-bccdc95cf-s5kzv 1/1 Running 0 133m kube-system etcd-k8s-1 1/1 Running 0 132m kube-system kube-apiserver-k8s-1 1/1 Running 0 132m kube-system kube-controller-manager-k8s-1 1/1 Running 0 132m kube-system kube-proxy-566w7 1/1 Running 0 133m kube-system kube-scheduler-k8s-1 1/1 Running 0 132m
6.添加node到集羣api
6.1在node節點上執行網絡
[root@k8s-2 ~]# kubeadm join 192.168.111.51:6443 --token u5455t.tnp9bx2lkm0wgzhl \ > --discovery-token-ca-cert-hash sha256:7811481be449b5464c80532986be38a670553ce3de102ef375b7cc1fceabcac9 [preflight] Running pre-flight checks [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -oyaml' [kubelet-start] Downloading configuration for the kubelet from the "kubelet-config-1.15" ConfigMap in the kube-system namespace [kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" [kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" [kubelet-start] Activating the kubelet service [kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap... This node has joined the cluster: * Certificate signing request was sent to apiserver and a response was received. * The Kubelet was informed of the new secure connection details. Run 'kubectl get nodes' on the control-plane to see this node join the cluster. [root@k8s-2 ~]#
在master節點查看nodeapp
友情推薦:一鍵安裝Kubernetes HA。 curl