CKA EXAM QS-12 2025
- Ingress now
- Oct 20
- 1 min read
Question 12:
First create a gateway named web-gateway with hostname gateway.web.k8s.local that maintain the existing TLS and listener configuration from the existing ingress resource named web.
Next, create an HTTPRoute named web-route with hostname gateway.web.k8s.local that maintains the existing routing rules from the current ingress resource named web.
You can test your Gateway API configuration with the following command:
finaly, Delete the existing ingress resource named web
=======================================================
Answer:
1- Navigate to kubernetes URL and search APIGateway and go to Gateway section
manifiest file
=======================================================
2- #vim gateway.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: web-gateway
spec:
gatewayClassName: nginx # check gatewayClassName in the exam environment
listeners:
- name: https
protocol: HTTPS
port: 443
hostname: "gateway.web.k8s.local" # remember from here 4 lines to add
tls:
mode: Terminate
certificateRefs:
- name: web-cert # run: kubectl get secret (to verify certificate in default ns)
#kubectl create -f gateway.yaml
Built manifest for HTTPRoute,
Navigate to kubernetes URL and search APIGateway and go to HTTPRoute section
manifiest file
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: web-route
spec:
parentRefs:
- name: web-gateway
hostnames:
- "gateway.web.k8s.local"
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: web # can check service name using: kubectl get svc
port: 80
#kubectl create -f httproute.yaml
#kubectl delete ingress web ===>#to delete web ingress as web-gateway is there
Note: Practice Please create gateway class (Not need to do in exam)
#vim gwclass.yaml
apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
name: nginx
spec:
controllerName: example.com/gateway-controller
#kubectl create -f gwclass.yaml




Comments