Skip to content

Instantly share code, notes, and snippets.

@prasvats
Created May 23, 2019 06:19
Show Gist options
  • Save prasvats/0a1ba313e2d27f80ff50c0a57ddbf85c to your computer and use it in GitHub Desktop.
Save prasvats/0a1ba313e2d27f80ff50c0a57ddbf85c to your computer and use it in GitHub Desktop.
Install K8 on CentOS | Pseudo Steps
#!/bin/bash
yum update
#Install repo adder
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 update && yum install docker-ce-18.06.2.ce
mkdir -p /etc/docker
cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2",
"storage-opts": [
"overlay2.override_kernel_check=true"
]
}
EOF
mkdir -p /etc/systemd/system/docker.service.d
systemctl daemon-reload
yum -y install bash-completion
yum -y install bash-completion-extras
yum -y install bash-completion-extras
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
exclude=kube*
EOF
setenforce 0
sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
cat <<EOF > /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
kubectl completion bash >/etc/bash_completion.d/kubectl
echo 'source <(kubectl completion bash)' >>~/.bashrc
systemctl enable --now kubelet
systemctl enable docker
systemctl enable kubelet
service kubelet start
service docker start
service docker status
service kubelet status
#Installing wave-net
#kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment