Skip to content

Commit

Permalink
feat: adds metallb
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaskuechler committed Feb 28, 2024
1 parent 86bcff1 commit 26fccce
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ ArgoCD should successfully get Nautobot deployed. Now come the OpenStack
components which aren't working with GitOps methods at this time.

[Install Keystone](./components/10-keystone/README.md)

### (Optional) Install MetalLB

[(Optional) Install MetalLB](./components/20-metallb/README.md)
28 changes: 28 additions & 0 deletions components/20-metallb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# MetalLB

We can use metallb with a couple unused IP addresses to provide
the Kubernetes LoadBalancer service type.

## Install MetalLB

```bash
cd components/20-metallb/
kubectl kustomize . | kubectl create -f -
```

## Edit and apply metallb config with our IP addresses

Things to change:
* IPAddressPool list of IPs
* L2Advertisement network interface name

```bash
vim example-create-metallb.yaml
kubectl apply -f example-create-metallb.yaml
```

## Simple test application to test if it's working

```bash
kubectl apply -f example-app-with-lb.yaml
```
33 changes: 33 additions & 0 deletions components/20-metallb/example-app-with-lb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: v1
kind: Service
metadata:
name: hello-kubernetes
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 8080
selector:
app: hello-kubernetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-kubernetes
spec:
replicas: 3
selector:
matchLabels:
app: hello-kubernetes
template:
metadata:
labels:
app: hello-kubernetes
spec:
containers:
- name: hello-kubernetes
image: paulbouwer/hello-kubernetes:1.8
ports:
- containerPort: 8080
---
30 changes: 30 additions & 0 deletions components/20-metallb/example-create-metallb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: lb-external
namespace: metallb-system
spec:
addresses:
- 10.22.37.207/32 # This is assumed to be the public LB vip address
- 10.22.37.208/32
- 10.22.37.209/32
- 10.22.37.210/32
- 10.22.37.211/32
- 10.22.37.212/32
- 10.22.37.213/32
autoAssign: true
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: lb-external-advertisement
namespace: metallb-system
spec:
ipAddressPools:
- lb-external
# nodeSelectors: # Optional block to limit nodes for a given advertisement
# - matchLabels:
# kubernetes.io/hostname: xs0018.b0013.ord.ohthree.com
interfaces: # Optional block to limit ifaces used to advertise VIPs
- ens1f0
6 changes: 6 additions & 0 deletions components/20-metallb/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://raw.githubusercontent.com/metallb/metallb/v0.14.3/config/manifests/metallb-native.yaml

0 comments on commit 26fccce

Please sign in to comment.