-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86bcff1
commit 26fccce
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |