Skip to content

Instantly share code, notes, and snippets.

@miticojo
Last active August 11, 2017 16:03
Show Gist options
  • Save miticojo/08341bb40d743195ae2f8f7180a9c0a5 to your computer and use it in GitHub Desktop.
Save miticojo/08341bb40d743195ae2f8f7180a9c0a5 to your computer and use it in GitHub Desktop.
Setup pre-requisites for Centos 7
#!/bin/bash
# disabling selinux
setenforce 0
sed "s/SELINUX=/SELINUX=disabled/g" -i /etc/selinux/config
# add personal public keys
curl -o - https://github.com/miticojo.keys >> ~/.ssh/authorized_keys
sed "s/PasswordAuthentication yes/PasswordAuthentication no/g" -i /etc/ssh/sshd_config
systemctl restart sshd
# add repository
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=http://yum.kubernetes.io/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 packages
yum install epel-release -y
yum install dnf -y
yum install -y docker kubelet kubeadm kubectl kubernetes-cni
# enable overlay driver
cat <<EOF > /etc/modules-load.d/overlay.conf
overlay
EOF
# setup docker to use overlay driver
cat <<EOF > /etc/sysconfig/docker-storage-setup
STORAGE_DRIVER="overlay"
DEVS=/dev/vdb
EOF
docker-storage-setup
# enabling services
systemctl enable docker
systemctl enable kubelet
# reboot to enable driver
systemctl reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment