MetalLB Installation with Helm
Kubernetes 1.19+
Helm 3.2.0+
StrictARP: True
kubectl get configmap kube-proxy -n kube-system -o yaml | \
sed -e "s/strictARP: false/strictARP: true/" | \
kubectl apply -f - -n kube-system
kubectl rollout restart -n kube-system daemonset kube-proxy
helm repo add metallb https://metallb.github.io/metallb
helm repo update metallb
helm install metallb metallb/metallb \
--create-namespace \
--namespace metallb-system
internal_ip="$(hostname -I | awk {'print $1'})"
instance_public_ip="$(curl ifconfig.me --silent)"
cat <<EOF | kubectl apply -f -
# IPAddressPool.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: production-public-ips
namespace: metallb-system
spec:
addresses:
- ${internal_ip}/32
autoAssign: false
EOF
kubectl annotate service 서비스명 -n 네임스페이스명 "metallb.universe.tf/address-pool=production-public-ips"
instance_public_ip="$(curl ifconfig.me --silent)"
kubectl annotate service 서비스명 -n 네임스페이스명 "metallb.universe.tf/allow-shared-ip=key-to-share-${instance_public_ip}"