
system: 
centos7



docker:
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm
wget https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
yum install docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm
yum install docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm

-----------Docker version 17.03.2-ce-------------

cat << EOF > /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": ["http://c32b78eb.m.daocloud.io"],
  "insecure-registries":["10.141.212.25:5555"]
}
EOF
service docker restart



kubeadm setup: (master)
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://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 <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

### export KUBECONFIG=/etc/kubernetes/admin.conf
### sysctl net.bridge.bridge-nf-call-iptables=1

sudo swapoff -a
cat <<EOF >  /root/.bash_profile
export KUBECONFIG=/etc/kubernetes/admin.conf
EOF
source /root/.bash_profile

-----------------------------------------------

kubeadm init --pod-network-cidr=10.244.0.0/16
kubeadm reset

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/v0.9.1/Documentation/kube-flannel.yml

kubectl get pods --all-namespaces
kubectl get nodes

------------- leave --------------

kubectl drain centos-minion-2 --delete-local-data --force --ignore-daemonsets
kubectl delete node centos-minion-2



join: (slave)
kubeadm join --token 58c15f.e98c48fa25e26132 10.141.211.171:6443 --discovery-token-ca-cert-hash sha256:46448ae9369e3a803ef7078bc4b9de9f0855d84f309f9cf25ff76fdef8538ce2
kubeadm reset


