Skip to content

Commit eaf97a3

Browse files
authored
Merge pull request #7331 from olofvndrhr/main
[Docs] Update Traefik ingress documentation and fix MetalLB docs
2 parents d93da61 + dbfed6b commit eaf97a3

File tree

2 files changed

+274
-163
lines changed

2 files changed

+274
-163
lines changed

docs/examples/metallb-loadbalancer.md

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ See the MetalLB requirements in the [MetalLB's official documentation](https://m
2626
```yaml
2727
apiVersion: k0s.k0sproject.io/v1beta1
2828
kind: ClusterConfig
29+
2930
metadata:
3031
name: k0s
32+
3133
spec:
3234
network:
3335
kubeProxy:
@@ -42,44 +44,53 @@ Port 7946 (TCP & UDP) must be allowed between the nodes. In addition, before ins
4244
4345
1. Install MetalLB using the official Helm chart and k0s Helm [extension manager](../helm-charts.md):
4446
45-
```shell
46-
apiVersion: k0s.k0sproject.io/v1beta1
47-
kind: ClusterConfig
48-
metadata:
49-
name: k0s
50-
spec:
51-
extensions:
52-
helm:
53-
repositories:
54-
- name: metallb
55-
url: https://metallb.github.io/metallb
56-
charts:
57-
- name: metallb
58-
chartname: metallb/metallb
59-
namespace: metallb
60-
```
61-
62-
Other installation methods are available in the [MetalLB's official documentation](https://metallb.org/installation/).
47+
```yaml
48+
apiVersion: k0s.k0sproject.io/v1beta1
49+
kind: ClusterConfig
50+
51+
metadata:
52+
name: k0s
53+
54+
spec:
55+
extensions:
56+
helm:
57+
repositories:
58+
- name: metallb
59+
url: https://metallb.github.io/metallb
60+
61+
charts:
62+
- name: metallb
63+
chartname: metallb/metallb
64+
version: "0.15.3"
65+
namespace: metallb-system
66+
```
67+
68+
Other installation methods are available in the [MetalLB's official documentation](https://metallb.org/installation/).
6369
6470
2. Create ConfigMap for MetalLB
6571
66-
Next you need to create ConfigMap, which includes an IP address range for the load balancer. The pool of IPs must be dedicated to MetalLB's use. You can't reuse for example the Kubernetes node IPs or IPs controlled by other services. You can, however, use private IP addresses, for example 192.168.1.180-192.168.1.199, but then you need to take care of the routing from the external network if you need external access. In this example, we don't need it.
72+
Next you need to create ConfigMap, which includes an IP address range for the load balancer. The pool of IPs must be dedicated to MetalLB's use. You can't reuse for example the Kubernetes node IPs or IPs controlled by other services. You can, however, use private IP addresses, for example 192.168.1.180-192.168.1.199, but then you need to take care of the routing from the external network if you need external access. In this example, we don't need it.
6773
68-
Create a YAML file accordingly, and deploy it: ```kubectl apply -f metallb-l2-pool.yaml```
74+
Create a YAML file accordingly, and deploy it: `kubectl apply -f metallb-l2-pool.yaml`
6975

7076
```YAML
7177
---
7278
apiVersion: metallb.io/v1beta1
7379
kind: IPAddressPool
80+
7481
metadata:
7582
name: first-pool
7683
namespace: metallb-system
84+
7785
spec:
7886
addresses:
79-
- <ip-address-range-start>-<ip-address-range-stop>
87+
- <ip-address-range-start>-<ip-address-range-stop>
88+
# or
89+
- <ip-address>/<cidr>
8090
---
8191
apiVersion: metallb.io/v1beta1
8292
kind: L2Advertisement
93+
8394
metadata:
8495
name: example
8596
namespace: metallb-system
@@ -90,14 +101,17 @@ Port 7946 (TCP & UDP) must be allowed between the nodes. In addition, before ins
90101
```YAML
91102
apiVersion: v1
92103
kind: Namespace
104+
93105
metadata:
94106
name: web
95107
---
96108
apiVersion: apps/v1
97109
kind: Deployment
110+
98111
metadata:
99112
name: web-server
100113
namespace: web
114+
101115
spec:
102116
selector:
103117
matchLabels:
@@ -115,9 +129,11 @@ Port 7946 (TCP & UDP) must be allowed between the nodes. In addition, before ins
115129
---
116130
apiVersion: v1
117131
kind: Service
132+
118133
metadata:
119134
name: web-server-service
120135
namespace: web
136+
121137
spec:
122138
selector:
123139
app: web
@@ -130,21 +146,21 @@ Port 7946 (TCP & UDP) must be allowed between the nodes. In addition, before ins
130146

131147
4. Check your LoadBalancer
132148

133-
Run the following command to see your LoadBalancer with the external-ip and port.
149+
Run the following command to see your LoadBalancer with the external-ip and port.
134150

135-
```shell
136-
kubectl get service -n web
137-
```
151+
```shell
152+
kubectl get service -n web
153+
```
138154

139155
5. Access your example application
140156

141-
If you used private IP addresses for MetalLB in the ConfigMap (in step 2), you should run the following command from the local network. Use the IP address from the previous step.
157+
If you used private IP addresses for MetalLB in the ConfigMap (in step 2), you should run the following command from the local network. Use the IP address from the previous step.
142158

143-
```shell
144-
curl <EXTERNAL-IP>
145-
```
159+
```shell
160+
curl <EXTERNAL-IP>
161+
```
146162

147-
If you are successful, you should see ```<html><body><h1>It works!</h1></body></html>```.
163+
If you are successful, you should see `<html><body><h1>It works!</h1></body></html>`.
148164

149165
## Additional information
150166

0 commit comments

Comments
 (0)