Kubernetes集群部署方式

  • 官方推荐的三种部署方式

  • minikube

Minikube是一个工具,可以在本地快速运行一个单点的Kubernetes,仅用于尝试Kubernetes或日常开发的用户使用。

部署地址:https://kubernetes.io/docs/setup/minikube/

  • kubeadm

Kubeadm工具,提供kubeadm init和kubeadm join,用于快速部署Kubernetes集群

部署地址:https://kubernetes.io/docs/reference/setup-tools/kubeadm/kubeadm/

  • 二进制

推荐,从官方下载发行版的二进制包手动部署每个组件,组成Kubernets集群

下载地址:https://github.com/kubernetes/kubernetes/releases

  • kubeadm工具部署Kubernetes集群 

192.168.10.81 k8s-master  CentOS7.4
192.168.10.82 k8s-node1  CentOS7.4
192.168.10.83 k8s-node2  CentOS7.4

[root@k8s-master ~]# kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
The connection to the server raw.githubusercontent.com was refused - did you specify the right host or port?

解决方案:https://blog.csdn.net/weixin_38074756/article/details/109231865

# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.10.81 k8s-master
192.168.10.82 k8s-node1
192.168.10.83 k8s-node2

185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.1111.133 raw.githubusercontent.com

kubeadm join 192.168.10.81:6443 --token cou3lz.por1p02ys9qcscc5 \
--discovery-token-ca-cert-hash sha256:dbcf75532c6eec7b17d74148432f042b57c656f69e6c0a946178f61247ba165d

 

[root@k8s-master ~]# kubectl get nodes
NAME         STATUS   ROLES    AGE     VERSION
k8s-master   Ready    master   24m     v1.18.3
k8s-node1    Ready    <none>   2m52s   v1.18.3
k8s-node2    Ready    <none>   2m42s   v1.18.3
[root@k8s-master ~]# kubectl get pod --all-namespaces
NAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGE
kube-system   coredns-7ff77c879f-p5v7b             1/1     Running   0          24m
kube-system   coredns-7ff77c879f-zdxp9             1/1     Running   0          24m
kube-system   etcd-k8s-master                      1/1     Running   0          24m
kube-system   kube-apiserver-k8s-master            1/1     Running   0          24m
kube-system   kube-controller-manager-k8s-master   1/1     Running   0          24m
kube-system   kube-flannel-ds-2lw2m                1/1     Running   0          2m55s
kube-system   kube-flannel-ds-b79pn                1/1     Running   0          3m55s
kube-system   kube-flannel-ds-jh5kv                1/1     Running   0          2m45s
kube-system   kube-proxy-fgkzn                     1/1     Running   0          2m55s
kube-system   kube-proxy-lrh86                     1/1     Running   0          24m
kube-system   kube-proxy-xv4v2                     1/1     Running   0          2m45s
kube-system   kube-scheduler-k8s-master            1/1     Running   0          24m
[root@k8s-master ~]# 

  

 

 

 

 

 

https://www.cnblogs.com/ltzhang/p/13544528.html

 

posted on 2022-01-16 11:32  HelonTian  阅读(90)  评论(0编辑  收藏  举报