Kubernetes 1.10 Centos 7.4 集群

全新安装Centos 7.4系统

1. 更新并安装软件

yum update -y
yum install docker wget vim git socat -y

2. 禁用selinux

vi /etc/selinux/config

3. 本地测试环境关闭防火墙

systemctl disable firewalld
systemctl stop firewalld

4. 安装k8s相关rpm包

35ea034b2efccf2529cca8ed44f1bdcc0c3b26f0139694d8cbea315077a1bf6e-kubeadm-1.10.1-0.x86_64.rpm
4cad7573e2617d903a12f5d318f597ec47bc0e67792a04f67ffee3e06c0ad373-kubelet-1.10.1-0.x86_64.rpm
b8f0cc3bc85e8614f0340547b14ca5377410afd087f51077410945a594f0b71b-kubectl-1.10.1-0.x86_64.rpm
fe33057ffe95bfae65e2f269e1b05e99308853176e24a4d027bc082b471a07c0-kubernetes-cni-0.6.0-0.x86_64.rpm

rpm -ivh *.rpm

5. 网络设置

cat < /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
# 或者
sysctl net.bridge.bridge-nf-call-iptables=1

6. 禁用swap

swapoff -a && sed -i '/swap/d' /etc/fstab

7. 启动服务

systemctl enable docker && systemctl start docker
systemctl enable kubelet && systemctl start kubelet

8. 装入k8s官方镜像

docker load -i 0c60bcf89900.tar
docker load -i 3f8119a98476.tar
docker load -i 6f7f2dc7fab5.tar
docker load -i 846921f0fe0e.tar
docker load -i 137a07dfd084.tar
docker load -i 2b736d06ca4c.tar
docker load -i 3f8119a98476.tar
docker load -i 52920ad46f5b.tar
docker load -i 6e6237849607.tar
docker load -i 6f7f2dc7fab5.tar
docker load -i 80cc5ea4b547.tar
docker load -i 8401bb3ff261.tar
docker load -i 846921f0fe0e.tar
docker load -i 9cc87078cdde.tar
docker load -i 9df3c00f55e6.tar
docker load -i a90209bb39e3.tar
docker load -i c2ce1ffb51ed.tar
docker load -i ceecd7155649.tar
docker load -i da86e6ba6ca1.tar

10. 初始化集群master节点

kubeadm init --pod-network-cidr=10.244.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export KUBECONFIG=/etc/kubernetes/admin.conf