--- install-docker-k8s.sh
+++ install-docker-k8s.sh
... | ... | @@ -2,16 +2,18 @@ |
2 | 2 |
# sudo로 실행 필요 |
3 | 3 |
# docker 설치 |
4 | 4 |
apt-get update |
5 |
-apt-get -y install \ |
|
6 |
- apt-transport-https \ |
|
7 |
- ca-certificates \ |
|
8 |
- curl \ |
|
9 |
- gnupg-agent \ |
|
10 |
- software-properties-common |
|
11 |
-curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - |
|
12 |
-add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
|
13 |
-apt-get -y update |
|
14 |
-apt-get -y install docker-ce docker-ce-cli containerd.io |
|
5 |
+apt-get install -y ca-certificates curl gnupg lsb-release wget git make |
|
6 |
+install -m 0755 -d /etc/apt/keyrings |
|
7 |
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc |
|
8 |
+chmod a+r /etc/apt/keyrings/docker.asc |
|
9 |
+ |
|
10 |
+echo \ |
|
11 |
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ |
|
12 |
+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ |
|
13 |
+ tee /etc/apt/sources.list.d/docker.list > /dev/null |
|
14 |
+ |
|
15 |
+apt-get update |
|
16 |
+apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
|
15 | 17 |
|
16 | 18 |
# Cgroup를 systemd로 설정 |
17 | 19 |
cat > /etc/docker/daemon.json <<EOF |
... | ... | @@ -40,22 +42,32 @@ |
40 | 42 |
|
41 | 43 |
# K8s 설치 |
42 | 44 |
# 네트워크 설정 |
43 |
-cat <<EOF | tee /etc/modules-load.d/k8s.conf |
|
45 |
+cat << EOF | sudo tee /etc/modules-load.d/k8s.conf |
|
46 |
+overlay |
|
44 | 47 |
br_netfilter |
45 | 48 |
EOF |
46 | 49 |
|
47 |
-cat <<EOF | tee /etc/sysctl.d/k8s.conf |
|
50 |
+modprobe overlay |
|
51 |
+modprobe br_netfilter |
|
52 |
+ |
|
53 |
+cat << EOF | sudo tee /etc/sysctl.d/k8s.conf |
|
54 |
+net.bridge.bridge-nf-call-iptables = 1 |
|
48 | 55 |
net.bridge.bridge-nf-call-ip6tables = 1 |
49 |
-net.bridge.bridge-nf-call-iptables = 1 |
|
56 |
+net.ipv4.ip_forward = 1 |
|
50 | 57 |
EOF |
51 | 58 |
|
52 | 59 |
sysctl --system |
53 | 60 |
|
61 |
+mkdir -p /etc/containerd |
|
62 |
+containerd config default | sudo tee /etc/containerd/config.toml |
|
63 |
+sed -i 's/ SystemdCgroup = false/ SystemdCgroup = true/' /etc/containerd/config.toml |
|
64 |
+sudo systemctl restart containerd |
|
65 |
+ |
|
54 | 66 |
apt-get update && apt-get install -y apt-transport-https curl |
55 | 67 |
|
56 |
-curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg |
|
68 |
+curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg |
|
57 | 69 |
|
58 |
-echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list |
|
70 |
+echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list |
|
59 | 71 |
|
60 | 72 |
apt-get update |
61 | 73 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?