首页 > 代码库 > 金庸武功之“乾坤大挪移”--kubenetes1.4容器集群搭建

金庸武功之“乾坤大挪移”--kubenetes1.4容器集群搭建

1 初始化环境

关闭selinux 关闭selinux 关闭selinux

1.1 环境:centos7.2

节点IP
node-1192.168.93.201
node-2192.168.93.202
node-3192.168.93.203

1.2 设置hostname

hostnamectl --static set-hostname hostname
IPhostname
192.168.93.201kube.master
192.168.93.202

kube.salve1

192.168.93.203

kube.salve2


1.3 配置 hosts

vi /etc/hosts
IPhostname
192.168.93.201
kube.master
192.168.93.202kube.salve1
192.168.93.203kube.salve2


2 部署 kubernetes master

2.1安装docker

增加repo

tee /etc/yum.repos.d/docker.repo <<-‘EOF‘

[dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg

EOF



Install the Docker package


yum install docker-engine -y

systemctl enable docker.service

systemctl start docker



2.2 添加yum

cat <<EOF> /etc/yum.repos.d/k8s.repo
[kubelet]
name=kubelet
baseurl=http://files.rm-rf.ca/rpms/kubelet/
enabled=1
gpgcheck=0
EOF
yum makecache

yum install -y socat kubelet kubeadm kubectl kubernetes-cni


2.3 下载镜像

images=(kube-proxy-amd64:v1.4.5 kube-discovery-amd64:1.0 kubedns-amd64:1.7 kube-scheduler-amd64:v1.4.5 kube-controller-manager-amd64:v1.4.5 kube-apiserver-amd64:v1.4.5 etcd-amd64:2.2.5 kube-dnsmasq-amd64:1.3 exechealthz-amd64:1.1 pause-amd64:3.0 kubernetes-dashboard-amd64:v1.4.1)
for imageName in ${images[@]} ; do
  docker pull jicki/$imageName
  docker tag jicki/$imageName gcr.io/google_containers/$imageName
  docker rmi jicki/$imageName
done








金庸武功之“乾坤大挪移”--kubenetes1.4容器集群搭建