MetalLB Installation on onpremise K8s Cluster
kubectl config get-contexts
Please select required kubeconfig file.
- Clone Repo
git clone https://gitlab.pudo.local/manas/devops.git
- Change Directory
cd kubernetes/metallb
- Create Namespace
kubectl create ns metallb-system
- Create Config Yaml
apiVersion: v1 kind: ConfigMap metadata: namespace: metallb-system name: config data: config: | address-pools: - name: my-ip-space protocol: layer2 addresses: - 10.255.134.160-10.255.134.170
- Apply YAML files
kubectl apply -f config.yaml kubectl apply -f metallb.yaml
- Create metallb secret
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
Service deploy edildikten sonra herhangi bir nginx image ile test edilebilir.
- Create Example Nginx Deployment
kubectl create deployment nginx --image=nginx
- Expose Your Deployment
kubectl expose deploy nginx --port 80 --type LoadBalancer
- Result
NAME | TYPE | CLUSTER-IP | EXTERNAL-IP | PORT(S) | AGE |
---|---|---|---|---|---|
nginx | LoadBalancer | 172.19.2219.173 | 10.255.134.16 | 80:30383/TCP,443:32503/TCP | 2m |
Eğer external ip belirlenen configmap te belirlenen aralıktan almıyorsa ya da "Pendin" statüsünde bekliyorsa lütfen konfigürasyonu tekrar kontrol edin!
Adesso DevOps - devops@adesso.com.tr