Skip to content

Commit 3a6513e

Browse files
committed
simplify samples
1 parent 25f4a92 commit 3a6513e

20 files changed

+1468
-766
lines changed

docs/examples/example1-getting-started/README.md renamed to docs/examples/example1-getting-started/README-ex1.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Before prefixes and ip addresses can be claimed with the NetBox operator, a pref
66

77
1. Port-forward NetBox: `kubectl port-forward --context kind-london deploy/netbox 8080:8080 -n default`
88
2. Open <http://localhost:8080> in your favorite browser and log in with the username `admin` and password `admin`
9-
3. Create a new prefix '3.0.0.64/26' with custom fields 'environment: prod'
9+
3. Create a new prefix '3.0.0.64/25' with custom fields 'environment: prod'
1010

1111
# 1.1 Claim a Prefix
1212

@@ -17,18 +17,17 @@ Before prefixes and ip addresses can be claimed with the NetBox operator, a pref
1717

1818
# 1.2 Dynamically Claim a Prefix with a Parent Prefix Selector
1919

20-
1. create the namespace where podinfo should be deployed `kubectl create --context kind-zurich ns int`
21-
2. Install podinfo with with the kustomization and apply the instance of the resource graph definition to claim a prefix and create the MetalLB IPAddressPool `kubectl apply --context kind-zurich -f docs/examples/example1-getting-started/simple_prefixclaim.yaml`
22-
3. check if the frontend service got an external ip address assigned `kubectl get --context pxc,px -w`
20+
1. Apply the manifest defining the prefix claim `kubectl apply --context kind-zurich -f docs/examples/example1-getting-started/dynamic-prefix-claim.yaml`
21+
2. Check if the frontend service got an external ip address assigned `kubectl get --context pxc,px -w`
2322

2423
![Example 1.2](dynamic-prefixclaim.drawio.svg)
2524

2625
# 1.3 Claim a Prefix for a Podinfo Deployment and Create a MetalLB IPAddressPool
2726

2827
This example uses [kro] to map the claimed prefix to a MetalLB IPAddressPool. The required resource graph definitions and kro were installed with the set-up script.
2928

30-
1. create the namespace where podinfo should be deployed `kubectl create --context kind-zurich ns test`
31-
2. Install podinfo with with the kustomization and apply the instance of the resource graph definition to claim a prefix and create the MetalLB IPAddressPool `kubectl apply --context kind-zurich -k docs/examples/example1-getting-started -n test`
29+
1. Apply the manifests to create a deployment with a service and a metallb-ip-address-pool-netbox to create a metalLB IPAddressPool from the prefix claimed from NetBox `kubectl apply --context kind-zurich -f docs/examples/example1-getting-started/ip-address-pool.yaml`
30+
2. Apply the manifests to createa deployment with a service that gets a ip assigned from the metalLB pool created in the prevoius step. `kubectl apply --context kind-zurich -k docs/examples/example1-getting-started/sample-deployment.yaml`
3231
3. check if the frontend service got an external ip address assigned `kubectl get --context kind-zurich svc podinfo -n test`
3332

3433

docs/examples/example1-getting-started/dynamic-prefix-claim.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ metadata:
77
name: dynamic-prefix-claim
88
spec:
99
tenant: "MY_TENANT"
10-
preserveInNetbox: true
1110
parentPrefixSelector:
1211
environment: prod
1312
family: IPv4

docs/examples/example1-getting-started/dynamic-prefixclaim.drawio.svg

+73-67
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kro.run/v1alpha1
2+
kind: MetalLBIPAddressPoolNetBox
3+
metadata:
4+
name: zurich-pool
5+
spec:
6+
name: zurich-pool
7+
tenant: "MY_TENANT" # Use the `name` value instead of the `slug` value
8+
prefixLength: "/30"
9+
parentPrefixSelector:
10+
environment: prod
11+
family: IPv4

docs/examples/example1-getting-started/metallb-ipaddresspool-netbox.drawio.svg

+266-78
Loading
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,43 @@
1-
apiVersion: kro.run/v1alpha1
2-
kind: MetalLBIPAddressPoolFromNetBoxParentPrefix
1+
---
2+
apiVersion: v1
3+
kind: Namespace
34
metadata:
4-
name: podinfo-test
5+
name: nginx
6+
---
7+
apiVersion: apps/v1
8+
kind: Deployment
9+
metadata:
10+
name: my-nginx
11+
namespace: nginx
12+
spec:
13+
selector:
14+
matchLabels:
15+
run: my-nginx
16+
replicas: 2
17+
template:
18+
metadata:
19+
labels:
20+
run: my-nginx
21+
spec:
22+
containers:
23+
- name: my-nginx
24+
image: nginx
25+
ports:
26+
- containerPort: 80
27+
---
28+
apiVersion: v1
29+
kind: Service
30+
metadata:
31+
name: my-nginx
32+
namespace: nginx
33+
labels:
34+
run: my-nginx
35+
annotations:
36+
metallb.universe.tf/address-pool: zurich-pool
537
spec:
6-
name: podinfo-test
7-
tenant: "MY_TENANT" # Use the `name` value instead of the `slug` value
8-
preserveInNetbox: true
9-
prefixLength: "/30"
10-
parentPrefix: 3.0.0.64/26
38+
type: LoadBalancer
39+
ports:
40+
- port: 80
41+
protocol: TCP
42+
selector:
43+
run: my-nginx

docs/examples/example1-getting-started/simple_prefixclaim.drawio.svg

+68-68
Loading

docs/examples/example1-getting-started/simple_prefixclaim.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ metadata:
77
name: simple-prefixclaim
88
spec:
99
tenant: "MY_TENANT"
10-
preserveInNetbox: true
11-
parentPrefix: 3.0.0.64/26
10+
parentPrefix: 3.0.0.64/25
1211
prefixLength: "/30"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Example 2: Multi Cluster
2+
3+
This example shows how to claim multiple prefixes from different clusters and make them available as metalLB ip address pools.
4+
5+
1. Create ip address pools on the london cluster `kubectl apply --context kind-london -f docs/examples/example2-multicluster/london-pools.yaml`
6+
2. Create ip address pool on the zurich cluster `kubectl create --context kind-zurich -f docs/examples/example2-multicluster/zurich-pools.yaml`
7+
3. Look up the created prefix claims and metalLB ipaddresspools `kubectl get --context kind-london pxc,ipaddresspools -A` and `kubectl get --context kind-zurich pxc,ipaddresspools -A`
8+
9+
![Example 2](multicluster.drawio.svg)

docs/examples/example2-multicluster/README.md

-8
This file was deleted.

0 commit comments

Comments
 (0)