BasicVersion
OS:Red Hat Enterprise Linux Server release 7.2 (Maipo)
Docker:docker-ce-17.12.1.ce-1.el7.centos.x86_64.rpm
download:https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce-1
K8S:v1.10.0
download:https://dl.k8s.io/v1.10.0/kubernetes.tar.gz
Install Docker
#clean EVN
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine -y
#install
yum install docker-ce-17.12.1.ce-1.el7.centos.x86_64.rpm -y
Install K8S
cat < /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpghttps://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF
setenforce 0
yum install -y kubelet kubeadm kubectl
systemctl enable kubelet && systemctl start kubelet
cat < /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
swapoff -a
#add {ip hostname} > /etc/hosts
kubeadm init --pod-network-cidr=192.160.0.0/16
mkdir -p $HOME/.kube
cp /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
#calico address resolution
echo "161.202.39.238 docs.projectcalico.org" >> /etc/hosts
#add node into k8s cluster,every node need to modify cgroup-driver
sed -i "s/cgroup-driver=systemd/cgroup-driver=cgroupfs/g" /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
systemctl daemon-reload
systemctl restart kubelet
#apply calico
kubectl apply -f https://docs.projectcalico.org/v3.1/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml