K8S scratch demo1.
This commit is contained in:
parent
eb6a3b5d37
commit
4213a9edc6
6 changed files with 0 additions and 0 deletions
18
2024/07/k8s_scratch_demo1/image/box.json
Normal file
18
2024/07/k8s_scratch_demo1/image/box.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
|
||||
"script": "scripts/setup.sh"
|
||||
}
|
||||
],
|
||||
"builders": [
|
||||
{
|
||||
"communicator": "ssh",
|
||||
"source_path": "debian/bullseye64",
|
||||
"provider": "virtualbox",
|
||||
"add_force": true,
|
||||
"type": "vagrant"
|
||||
}
|
||||
]
|
||||
}
|
63
2024/07/k8s_scratch_demo1/image/scripts/setup.sh
Normal file
63
2024/07/k8s_scratch_demo1/image/scripts/setup.sh
Normal file
|
@ -0,0 +1,63 @@
|
|||
#!/bin/sh
|
||||
|
||||
apt-get update
|
||||
apt-get install -y vim
|
||||
|
||||
cat << EOF | tee /etc/modules-load.d/k8s.conf
|
||||
|
||||
overlay
|
||||
br_netfilter
|
||||
|
||||
EOF
|
||||
|
||||
modprobe overlay
|
||||
modprobe br_netfilter
|
||||
|
||||
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
|
||||
|
||||
net.bridge.bridge-nf-call-iptables = 1
|
||||
net.bridge.bridge-nf-call-ip6tables = 1
|
||||
net.ipv4.ip_forward = 1
|
||||
|
||||
EOF
|
||||
|
||||
sysctl --system
|
||||
|
||||
cd /tmp
|
||||
|
||||
test -f containerd-1.7.11-linux-amd64.tar.gz || wget https://github.com/containerd/containerd/releases/download/v1.7.11/containerd-1.7.11-linux-amd64.tar.gz
|
||||
tar Cxzvf /usr/local containerd-1.7.11-linux-amd64.tar.gz
|
||||
|
||||
mkdir -p /etc/containerd
|
||||
containerd config default > config.toml
|
||||
cp config.toml /etc/containerd
|
||||
|
||||
test -f containerd.service || wget https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
|
||||
cp containerd.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now containerd
|
||||
|
||||
test -f runc.amd64 || wget https://github.com/opencontainers/runc/releases/download/v1.1.10/runc.amd64
|
||||
install -m 755 runc.amd64 /usr/local/sbin/runc
|
||||
|
||||
test -f cni-plugins-linux-amd64-v1.4.0.tgz || wget https://github.com/containernetworking/plugins/releases/download/v1.4.0/cni-plugins-linux-amd64-v1.4.0.tgz
|
||||
mkdir -p /opt/cni/bin
|
||||
tar Cxzvf /opt/cni/bin cni-plugins-linux-amd64-v1.4.0.tgz
|
||||
|
||||
sed -i.bak "s/SystemdCgroup.*$/SystemdCgroup = true/g" /etc/containerd/config.toml
|
||||
|
||||
systemctl restart containerd
|
||||
|
||||
apt-get update
|
||||
apt-get install -y apt-transport-https ca-certificates curl gpg
|
||||
|
||||
mkdir -p /etc/apt/keyrings
|
||||
test -f /etc/apt/keyrings/kubernetes-apt-keyring.gpg || ( curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg )
|
||||
|
||||
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||
apt-get update
|
||||
apt-get install -y kubelet=1.28.4-1.1 kubeadm=1.28.4-1.1 kubectl=1.28.4-1.1
|
||||
|
||||
swapoff -a
|
||||
|
||||
sed -i.bak -E "s/^.*swap.*//g" /etc/fstab
|
Loading…
Add table
Add a link
Reference in a new issue