Skip to content

Instantly share code, notes, and snippets.

@taking
Last active May 19, 2023 01:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taking/0865f604513be357b7ffc9e2de0bc47a to your computer and use it in GitHub Desktop.
Save taking/0865f604513be357b7ffc9e2de0bc47a to your computer and use it in GitHub Desktop.

metallb Installation with metallb-Operator

Repo

Prerequisites

  • Kubernetes 1.19+

install

kubectl apply -f https://raw.githubusercontent.com/metallb/metallb-operator/v0.13.11/bin/metallb-operator.yaml

Install (Metallb)

cat << EOF | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: MetalLB
metadata:
  name: metallb
  namespace: metallb-system
EOF

IpAddressPool Create

internal_ip="$(hostname -I | awk {'print $1'})"

cat <<EOF | kubectl apply -f -
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: production-public-ips
  namespace: metallb-system
spec:
  addresses:
  - ${internal_ip}/32
  autoAssign: false
EOF

how-to

  - 192.168.10.0/24
  - 192.168.9.1-192.168.9.5
  - fc00:f853:0ccd:e799::/124

Example

kubectl patch service istio-gateway -n istio-system -p '{"metadata": {"annotations":{"metallb.universe.tf/address-pool":"production-public-ips"}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment