Skip to content

Commit eb9a22c

Browse files
committed
fix(k8s): content update
1 parent fb90982 commit eb9a22c

File tree

2 files changed

+242
-246
lines changed

2 files changed

+242
-246
lines changed

pages/kubernetes/reference-content/lb-ingress-controller.mdx

Lines changed: 116 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -68,144 +68,140 @@ To use a persistent IP with the ingress controller:
6868
Use Helm to deploy the NGINX ingress controller with Scaleway-specific configurations.
6969

7070
1. Add the NGINX ingress Helm repository
71-
72-
```bash
73-
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
74-
helm repo update
75-
```
71+
```bash
72+
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
73+
helm repo update
74+
```
7675

7776
2. Create a file named `ingress-values.yaml` with and edit the `loadBalancerIP` to your flexible IP:
78-
79-
```yaml
80-
controller:
81-
service:
82-
type: LoadBalancer
83-
# Specify reserved flexible IP
84-
loadBalancerIP: "195.154.72.226"
85-
annotations:
86-
# Enable PROXY protocol v2
87-
service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2: "true"
88-
# Use hostname for cert-manager compatibility
89-
service.beta.kubernetes.io/scw-loadbalancer-use-hostname: "true"
90-
config:
91-
# Enable PROXY protocol in NGINX
92-
use-proxy-protocol: "true"
93-
use-forwarded-headers: "true"
94-
compute-full-forwarded-for: "true"
95-
```
96-
<Message type="note">
97-
- Replace `195.154.72.226` with your reserved flexible IP. Omitting `loadBalancerIP` results in an ephemeral IP.
98-
- The `service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2` annotation enables PROXY protocol v2.
99-
- The `service.beta.kubernetes.io/scw-loadbalancer-use-hostname` annotation supports cert-manager HTTP01 challenges.
100-
</Message>
77+
```yaml
78+
controller:
79+
service:
80+
type: LoadBalancer
81+
# Specify reserved flexible IP
82+
loadBalancerIP: "195.154.72.226"
83+
annotations:
84+
# Enable PROXY protocol v2
85+
service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2: "true"
86+
# Use hostname for cert-manager compatibility
87+
service.beta.kubernetes.io/scw-loadbalancer-use-hostname: "true"
88+
config:
89+
# Enable PROXY protocol in NGINX
90+
use-proxy-protocol: "true"
91+
use-forwarded-headers: "true"
92+
compute-full-forwarded-for: "true"
93+
```
94+
<Message type="note">
95+
- Replace `195.154.72.226` with your reserved flexible IP. Omitting `loadBalancerIP` results in an ephemeral IP.
96+
- The `service.beta.kubernetes.io/scw-loadbalancer-proxy-protocol-v2` annotation enables PROXY protocol v2.
97+
- The `service.beta.kubernetes.io/scw-loadbalancer-use-hostname` annotation supports cert-manager HTTP01 challenges.
98+
</Message>
10199

102100
3. Deploy the ingress controller:
103-
104-
```bash
105-
helm install ingress-nginx ingress-nginx/ingress-nginx -f ingress-values.yaml --namespace ingress-nginx --create-namespace
106-
```
101+
```bash
102+
helm install ingress-nginx ingress-nginx/ingress-nginx -f ingress-values.yaml --namespace ingress-nginx --create-namespace
103+
```
107104

108105
4. Verify the LoadBalancer IP using `kubectl`:
109-
```bash
110-
kubectl get svc -n ingress-nginx ingress-nginx-controller
111-
```
112-
113-
You will see an output similar to the following example:
114-
```
115-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
116-
ingress-nginx-controller LoadBalancer 10.100.0.1 195.154.72.226 80/TCP,443/TCP 5m
117-
```
118-
<Message type="note">
119-
- The `EXTERNAL-IP` should match your reserved flexible IP (e.g., `195.154.72.226`).
120-
- If an ephemeral IP appears, verify that the `loadBalancerIP` field is correctly set and matches a valid flexible IP attached to your Scaleway project.
121-
- Confirm the LoadBalancer in the Scaleway console under **Network > Load Balancers**.
122-
</Message>
106+
```bash
107+
kubectl get svc -n ingress-nginx ingress-nginx-controller
108+
```
109+
110+
You will see an output similar to the following example:
111+
```
112+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
113+
ingress-nginx-controller LoadBalancer 10.100.0.1 195.154.72.226 80/TCP,443/TCP 5m
114+
```
115+
<Message type="note">
116+
- The `EXTERNAL-IP` should match your reserved flexible IP (e.g., `195.154.72.226`).
117+
- If an ephemeral IP appears, verify that the `loadBalancerIP` field is correctly set and matches a valid flexible IP attached to your Scaleway project.
118+
- Confirm the LoadBalancer in the Scaleway console under **Network > Load Balancers**.
119+
</Message>
123120

124121
5. Configure DNS by setting the A-Record of your domain (e.g., `demo.example.com`) to the flexible IP via Scaleway's Domains & DNS product or your DNS provider. Persistent IPs ensure stability and will not change as long as they are reserved.
125122

126123
### Deploying a Demo Application
127-
Deploy a simple web application to test the ingress controller.
128-
129-
1. Create a file named `demo-app.yaml` and copy the following content into it:
130-
131-
```yaml
132-
apiVersion: apps/v1
133-
kind: Deployment
134-
metadata:
135-
name: demo-app
136-
namespace: default
137-
spec:
138-
replicas: 2
139-
selector:
140-
matchLabels:
141-
app: demo-app
142-
template:
143-
metadata:
144-
labels:
124+
125+
1. Create a file named `demo-app.yaml` and copy the following content into it to deploy a simple web application to test the ingress controller:
126+
127+
```yaml
128+
apiVersion: apps/v1
129+
kind: Deployment
130+
metadata:
131+
name: demo-app
132+
namespace: default
133+
spec:
134+
replicas: 2
135+
selector:
136+
matchLabels:
145137
app: demo-app
146-
spec:
147-
containers:
148-
- name: demo-app
149-
image: nginx:1.21
150-
ports:
151-
- containerPort: 80
152-
---
153-
apiVersion: v1
154-
kind: Service
155-
metadata:
156-
name: demo-app
157-
namespace: default
158-
spec:
159-
selector:
160-
app: demo-app
161-
ports:
162-
- protocol: TCP
163-
port: 80
164-
targetPort: 80
165-
---
166-
apiVersion: networking.k8s.io/v1
167-
kind: Ingress
168-
metadata:
169-
name: demo-app-ingress
170-
namespace: default
171-
annotations:
172-
nginx.ingress.kubernetes.io/rewrite-target: /
173-
spec:
174-
ingressClassName: nginx
175-
rules:
176-
- host: demo.example.com
177-
http:
178-
paths:
179-
- path: /
180-
pathType: Prefix
181-
backend:
182-
service:
183-
name: demo-app
184-
port:
185-
number: 80
186-
```
187-
188-
<Message type="note">
189-
- Replace `demo.example.com` with your domain name.
190-
</Message>
138+
template:
139+
metadata:
140+
labels:
141+
app: demo-app
142+
spec:
143+
containers:
144+
- name: demo-app
145+
image: nginx:1.21
146+
ports:
147+
- containerPort: 80
148+
---
149+
apiVersion: v1
150+
kind: Service
151+
metadata:
152+
name: demo-app
153+
namespace: default
154+
spec:
155+
selector:
156+
app: demo-app
157+
ports:
158+
- protocol: TCP
159+
port: 80
160+
targetPort: 80
161+
---
162+
apiVersion: networking.k8s.io/v1
163+
kind: Ingress
164+
metadata:
165+
name: demo-app-ingress
166+
namespace: default
167+
annotations:
168+
nginx.ingress.kubernetes.io/rewrite-target: /
169+
spec:
170+
ingressClassName: nginx
171+
rules:
172+
- host: demo.example.com
173+
http:
174+
paths:
175+
- path: /
176+
pathType: Prefix
177+
backend:
178+
service:
179+
name: demo-app
180+
port:
181+
number: 80
182+
```
183+
184+
<Message type="note">
185+
- Replace `demo.example.com` with your domain name.
186+
</Message>
191187

192188
2. Apply the configuration:
193-
```bash
194-
kubectl apply -f demo-app.yaml
195-
```
189+
```bash
190+
kubectl apply -f demo-app.yaml
191+
```
196192

197193
## Test the Setup
198194
1. Access the demo application:
199-
```bash
200-
curl http://demo.example.com
201-
# or
202-
curl http://195.154.72.226/
203-
```
195+
```bash
196+
curl http://demo.example.com
197+
# or
198+
curl http://195.154.72.226/
199+
```
204200

205201
2. You should see the NGINX welcome page. Verify the PROXY protocol by checking logs for the client's real IP:
206-
```bash
207-
kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx
208-
```
202+
```bash
203+
kubectl logs -n ingress-nginx -l app.kubernetes.io/name=ingress-nginx
204+
```
209205

210206
## Cleanup (optional)
211207
Once fininshed you can remove the demo application and ingress controller from your cluster:

0 commit comments

Comments
 (0)