Kubernetes集群部署之一系统环境初始化详解架构师

安装版本:

centos   version:        7.4 
docker   version:        18.03.1-ce 
kubectl  version:        v1.10.1 
etcdctl  version:        3.2.18 
Flannel  version:       v0.10.0

基本架构:

IP地址 主机名 服务
10.200.3.105 k8s-master etcd/docker/kube-apiserver/kube-controller-manager/kube-scheduler/flannel
10.200.3.106 k8s-node-1 etcd/docker/kube-proxy/kubelet/flannel
10.200.3.107 k8s-node-2 etcd/docker/kube-proxy/kubelet/flannel

1. 关闭SELinux和防火墙

#systemctl disable firewalld.service 
#systemctl stop firewalld.service 

2.设置主机名:

# hostnamectl --static set-hostname k8s-master 
# hostnamectl --static set-hostname k8s-node-1 
# hostnamectl --static set-hostname k8s-node-2 

3.设置/etc/hosts保证主机名能够解析

10.200.3.105    k8s-master 
10.200.3.106    k8s-node-1 
10.200.3.107    k8s-node-2

4. 设置部署节点到其它所有节点的SSH免密码登录

[[email protected] ~]# ssh-keygen -t rsa     
[[email protected]-master ~]# ssh-copy-id k8s-master 
[[email protected]-master ~]# ssh-copy-id k8s-node-1 
[[email protected]-master ~]# ssh-copy-id k8s-node-2

5.安装Docker(三台主机都安装)

第一步:使用国内Docker源

[[email protected] ~]# cd /etc/yum.repos.d/ 
[[email protected]-master yum.repos.d]#  wget / 
  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 
--2018-05-30 17:20:48--  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 103.15.99.96, 103.15.99.93, 103.15.99.94, ... 
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|103.15.99.96|:443... connected. 
HTTP request sent, awaiting response... 200 OK 
Length: 2640 (2.6K) [application/octet-stream] 
Saving to: ‘docker-ce.repo’ 
 
100%[===========================================================================================>] 2,640       --.-K/s   in 0s       
 
2018-05-30 17:20:49 (63.8 MB/s) - ‘docker-ce.repo’ saved [2640/2640]

第二步:Docker安装:

[[email protected] yum.repos.d]# yum install -y docker-ce

第三步:启动后台进程:

[[email protected] ~]# systemctl start docker

6.准备部署目录

#mkdir -p /opt/kubernetes/{cfg,bin,ssl,log}

  

原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/6900.html

(0)
上一篇 2021年7月17日
下一篇 2021年7月17日

相关推荐

发表回复

登录后才能评论