Skip to content

Instantly share code, notes, and snippets.

@jacqinthebox
Last active March 1, 2019 06:27
Show Gist options
  • Save jacqinthebox/1a2f465b91dad7b2bc0455acaf7f850f to your computer and use it in GitHub Desktop.
Save jacqinthebox/1a2f465b91dad7b2bc0455acaf7f850f to your computer and use it in GitHub Desktop.

Notes on how to install Kubernetes on Centos 7

setenforce 0
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux

yum -y install net-tools 
modprobe br_netfilter
echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables
yum install vim

Turn off swap

swapoff -a
vim /etc/fstab

Install Docker and dependencies.

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce

Install Kubernetes

Get binaries

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

Install

yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
systemctl enable --now kubelet
sudo reboot

Init cluster

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl start docker && systemctl enable docker
systemctl start kubelet && systemctl enable kubelet
docker info | grep -i cgroup
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
kubeadm init --pod-network-cidr=10.244.0.0/16
cp /etc/kubernetes/admin.conf .
mkdir .kube
cp admin.conf .kube/
cd .kube/
mv admin.conf config
export KUBECONFIG=/etc/kubernetes/admin.conf
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml
kubectl taint nodes --all node-role.kubernetes.io/master-

https://kubernetes.io/docs/setup/independent/install-kubeadm/
https://www.howtoforge.com/tutorial/centos-kubernetes-docker-cluster/#prerequisites

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