sudo mkdir -p /etc/rancher/k3s
sudo vi /etc/rancher/k3s/config.yaml
# /etc/rancher/k3s/config.yaml
cluster-init: true
disable:
- traefik
- servicelb
kube-proxy-arg:
- ipvs-strict-arp=true
write-kubeconfig-mode: "0644"
curl -sfL https://get.k3s.io | sh -
워커 노드 설치할 때 필요.
sudo cat /var/lib/rancher/k3s/server/token
curl -sfL https://get.k3s.io | K3S_URL=<마스터 노드 IP>:6443 K3S_TOKEN=<TOKEN> sh -
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb
kubectl label namespace metallb-system pod-security.kubernetes.io/enforce=privileged --overwrite
kubectl label namespace metallb-system pod-security.kubernetes.io/audit=privileged --overwrite
kubectl label namespace metallb-system pod-security.kubernetes.io/warn=privileged --overwrite
# metallb.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: ip-address-pool
namespace: metallb-system
spec:
addresses:
- 192.168.100.10-192.168.100.50
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: l2-advertisement
namespace: metallb-system
spec:
ipAddressPools:
- ip-address-pool
kubectl apply -f metallb.yaml