forked from sandervanvugt/cka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e78436
commit 36c4472
Showing
4 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/bash | ||
# script that runs | ||
# https://kubernetes.io/docs/setup/production-environment/container-runtime | ||
|
||
# setting MYOS variable | ||
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }') | ||
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }') | ||
|
||
##### CentOS 7 config | ||
if [ $MYOS = "centos" ] | ||
then | ||
echo setting up CentOS 7 with Docker | ||
yum install -y vim yum-utils device-mapper-persistent-data lvm2 | ||
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
|
||
# notice that only verified versions of Docker may be installed | ||
# verify the documentation to check if a more recent version is available | ||
|
||
yum install -y docker-ce | ||
[ ! -d /etc/docker ] && mkdir /etc/docker | ||
|
||
mkdir -p /etc/systemd/system/docker.service.d | ||
|
||
|
||
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 | ||
|
||
|
||
systemctl daemon-reload | ||
systemctl restart docker | ||
systemctl enable docker | ||
|
||
systemctl disable --now firewalld | ||
fi | ||
|
||
echo printing MYOS $MYOS | ||
|
||
if [ $MYOS = "Ubuntu" ] | ||
then | ||
### setting up container runtime prereq | ||
cat <<- EOF | sudo tee /etc/modules-load.d/containerd.conf | ||
overlay | ||
br_netfilter | ||
EOF | ||
|
||
sudo modprobe overlay | ||
sudo modprobe br_netfilter | ||
|
||
# Setup required sysctl params, these persist across reboots. | ||
cat <<- EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf | ||
net.bridge.bridge-nf-call-iptables = 1 | ||
net.ipv4.ip_forward = 1 | ||
net.bridge.bridge-nf-call-ip6tables = 1 | ||
EOF | ||
|
||
# Apply sysctl params without reboot | ||
sudo sysctl --system | ||
|
||
# (Install containerd) | ||
sudo apt-get update && sudo apt-get install -y containerd | ||
# Configure containerd | ||
sudo mkdir -p /etc/containerd | ||
containerd config default | sudo tee /etc/containerd/config.toml | ||
# Restart containerd | ||
sudo systemctl restart containerd | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
# script that runs | ||
# https://kubernetes.io/docs/setup/production-environment/container-runtime | ||
|
||
yum install -y vim yum-utils device-mapper-persistent-data lvm2 | ||
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
|
||
# notice that only verified versions of Docker may be installed | ||
# verify the documentation to check if a more recent version is available | ||
|
||
yum install -y docker-ce | ||
[ ! -d /etc/docker ] && mkdir /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 | ||
systemctl restart docker | ||
systemctl enable docker | ||
|
||
systemctl disable --now firewalld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf | ||
br_netfilter | ||
EOF | ||
|
||
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf | ||
net.bridge.bridge-nf-call-ip6tables = 1 | ||
net.bridge.bridge-nf-call-iptables = 1 | ||
EOF | ||
sudo sysctl --system | ||
|
||
sudo apt-get update && sudo apt-get install -y apt-transport-https curl | ||
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - | ||
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list | ||
deb https://apt.kubernetes.io/ kubernetes-xenial main | ||
EOF | ||
sudo apt-get update | ||
sudo apt-get install -y kubelet kubeadm kubectl | ||
sudo apt-mark hold kubelet kubeadm kubectl | ||
|
||
|