kubeadm config print init-defaults > kubeadm-init.yaml
vi kubeadm-init.yaml
apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: abcdef.0123456789abcdef
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 192.168.101.201
bindPort: 6443
nodeRegistration:
criSocket: unix:///var/run/containerd/containerd.sock
imagePullPolicy: IfNotPresent
name: m1.lab1.px.local
taints: null
---
apiServer:
timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta3
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns: {}
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: registry.k8s.io
kind: ClusterConfiguration
kubernetesVersion: 1.27.0
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/12
podSubnet: 10.224.0.0/16
scheduler: {}
localAPIEndpoint.advertiseAddress | 마스터 노드의 IP |
nodeRegistration.name | 마스터 노드의 호스트명 |
clusterName | 쿠버네티스 클러스터 명 |
networking.podSubnet | Pod에 할당되는 IP 범위 |
kubeadm init --config=kubeadm-init.yaml
mkdir -p $HOME/.kube && \
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config && \
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubeadm token create --print-join-command
kubeadm join 192.168.101.201:6443 --token g1ulmw.9xcrzcaj05it1aqy --discovery-token-ca-cert-hash \
sha256:0b2215b0d0e0a08cbff01b9d34b9f08791cc80e512c98c8493623f4ab3bce36c
wget https://raw.githubusercontent.com/projectcalico/calico/v3.27.2/manifests/calico.yaml --no-check-certificate
kubectl apply -f calico.yaml
kubectl get nodes
kubectl get po -A