feat: add MetalLB for on-premise LoadBalancer support
Some checks failed
scrum-manager/pipeline/head There was a failure building this commit
Some checks failed
scrum-manager/pipeline/head There was a failure building this commit
- Add MetalLB IPAddressPool (192.168.108.213/32) and L2Advertisement so the frontend gets a stable external IP on the LAN - Change frontend service type: NodePort → LoadBalancer - Add 'Setup MetalLB' stage in Jenkinsfile that installs MetalLB v0.14.8 (idempotent) and applies the IP pool config before each deploy After deploy: kubectl get svc frontend -n scrum-manager should show EXTERNAL-IP: 192.168.108.213 App accessible at: http://192.168.108.213 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@@ -110,6 +110,24 @@ pipeline {
|
||||
}
|
||||
}
|
||||
|
||||
stage('Setup MetalLB') {
|
||||
steps {
|
||||
withKubeConfig([credentialsId: "${K8S_CRED_ID}"]) {
|
||||
sh """
|
||||
# Install MetalLB if not already present (idempotent)
|
||||
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.8/config/manifests/metallb-native.yaml
|
||||
|
||||
# Wait for MetalLB controller and speaker to be ready
|
||||
kubectl rollout status deployment/controller -n metallb-system --timeout=90s
|
||||
kubectl rollout status daemonset/speaker -n metallb-system --timeout=90s
|
||||
|
||||
# Apply IP pool config — CRDs must be ready before this
|
||||
kubectl apply -f k8s/overlays/on-premise/metallb/
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy to K8s') {
|
||||
steps {
|
||||
withKubeConfig([credentialsId: "${K8S_CRED_ID}"]) {
|
||||
|
||||
@@ -6,7 +6,7 @@ metadata:
|
||||
app.kubernetes.io/name: frontend
|
||||
app.kubernetes.io/component: web
|
||||
spec:
|
||||
type: NodePort
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
|
||||
8
k8s/overlays/on-premise/metallb/ipaddresspool.yaml
Normal file
8
k8s/overlays/on-premise/metallb/ipaddresspool.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: IPAddressPool
|
||||
metadata:
|
||||
name: scrum-manager-pool
|
||||
namespace: metallb-system
|
||||
spec:
|
||||
addresses:
|
||||
- 192.168.108.213/32
|
||||
8
k8s/overlays/on-premise/metallb/l2advertisement.yaml
Normal file
8
k8s/overlays/on-premise/metallb/l2advertisement.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: L2Advertisement
|
||||
metadata:
|
||||
name: scrum-manager-l2
|
||||
namespace: metallb-system
|
||||
spec:
|
||||
ipAddressPools:
|
||||
- scrum-manager-pool
|
||||
Reference in New Issue
Block a user