Exposing a Kubernetes Kapsule ingress controller service with a Load Balancer
Reviewed on 14 October 2024 • Published on 05 May 2020
This document will guide you through deploying a test application on a Kubernetes cluster, exposing it via an ingress object, and using a Scaleway Load Balancer to ensure persistent IP addressing.
By default, ingress controllers on Kapsule are deployed using a hostPort. This ensures accessibility on all cluster nodes via ports 80 and 443. However, for production readiness, you might prefer using a Load Balancer to expose your services to the internet.
Important
By default, a new security group that blocks all incoming traffic on the nodes for security purposes is created during cluster configuration. To allow incoming HTTP/80 and HTTPS/443 traffic, you need to modify the security group.
In the Scaleway console, navigate to the Compute > Security groups section and find the security group named kubernetes <cluster-id>.
Modify the security group rules to allow incoming traffic on ports 80 (HTTP) and 443 (HTTPS).
Allow TCP traffic on port 80 from all sources (0.0.0.0/0) for HTTP.
Allow TCP traffic on port 443 from all sources (0.0.0.0/0) for HTTPS.
Create the ingress object (coffee-ingress.yaml) using the DNS wildcard provided by Scaleway:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: coffee-ingress
spec:
rules:
-host: YOUR_SCALEWAY_DNS_WILDCARD
http:
paths:
-path: /tea
pathType: Prefix
backend:
service:
name: tea-svc
port:
number:80
-path: /coffee
pathType: Prefix
backend:
service:
name: coffee-svc
port:
number:80
Note
Your DNS wildcard is composed of your cluster ID (e.g., 68362d3b-57c8-4bea-905a-aeb7f9ab95dc) followed by .nodes.k8s.<SCW_REGION>.scw.cloud. For a cluster located in the Paris region, your DNS wildcard could be, for example: hotdrinks.68362d3b-57c8-4bea-905a-aeb7f9ab95dc.nodes.k8s.fr-par.scw.cloud.