Skip to content

Instantly share code, notes, and snippets.

@avoidik
Last active January 17, 2018 15:16
Show Gist options
  • Select an option

  • Save avoidik/82f57f616c7345ee7d1b16c5ba0cbd9b to your computer and use it in GitHub Desktop.

Select an option

Save avoidik/82f57f616c7345ee7d1b16c5ba0cbd9b to your computer and use it in GitHub Desktop.
centos kubernetes cluster

I successfully setup my Kubernetes cluster on centos-release-7-3.1611.el7.centos.x86_64 by taking the following steps (I assume Docker is already installed):

  1. (from /etc/yum.repo.d/kubernetes.repo) baseurl=http://yum.kubernetes.io/repos/kubernetes-el7-x86_64-unstable => To use the unstable repository for the latest Kubernetes 1.6.1
  2. yum install -y kubelet kubeadm kubectl kubernetes-cni
  3. (/etc/systemd/system/kubelet.service.d/10-kubeadm.conf) add "--cgroup-driver=systemd" at the end of the last line. => This is because Docker uses systemd for cgroup-driver while kubelet uses cgroupfs for cgroup-driver.
  4. systemctl enable kubelet && systemctl start kubelet
  5. kubeadm init --pod-network-cidr 10.244.0.0/16 => If you used to add --api-advertise-addresses, you need to use --apiserver-advertise-address instead.
  6. cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf => Without this step, you might get an error with kubectl get => I didn't do it with 1.5.2
  7. kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel-rbac.yml => 1.6.0 introduces a role-based access control so you should add a ClusterRole and a ClusterRoleBinding before creating a Flannel daemonset
  8. kubectl create -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml => Create a Flannel daemonset
  9. (on every slave node) kubeadm join --token (your token) (ip):(port) => as shown in the result of kubeadm init

All the above steps are a result of combining suggestions from various issues around Kubernetes-1.6.0, especially kubeadm.

Hope this will save your time.

Source

Comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment