0
0
Kubernetesdevops~10 mins

Ingress controllers (Nginx, Traefik) in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the kind of resource for an Ingress in Kubernetes.

Kubernetes
apiVersion: networking.k8s.io/v1
kind: [1]
metadata:
  name: example-ingress
Drag options to blanks, or click blank then click option'
AIngress
BService
CPod
DDeployment
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Service' or 'Deployment' instead of 'Ingress' for the kind field.
2fill in blank
medium

Complete the code to specify the backend service name in an Ingress rule.

Kubernetes
spec:
  rules:
  - http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: [1]
            port:
              number: 80
Drag options to blanks, or click blank then click option'
Amy-app
Bfrontend
Cbackend-pod
Dnginx-service
Attempts:
3 left
💡 Hint
Common Mistakes
Using Pod or Deployment names instead of Service names.
3fill in blank
hard

Fix the error in the annotation to enable the NGINX ingress controller to rewrite the target URL.

Kubernetes
metadata:
  annotations:
    nginx.ingress.kubernetes.io/[1]: "/newpath"
Drag options to blanks, or click blank then click option'
Arewrite_path
Brewrite-target
CrewriteTarget
Drewrite-url
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or camelCase in annotation keys.
4fill in blank
hard

Fill both blanks to define a Traefik IngressRoute with a rule matching the host and forwarding to a service.

Kubernetes
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: example-ingressroute
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`[1]`)
    kind: Rule
    services:
    - name: [2]
      port: 80
Drag options to blanks, or click blank then click option'
Aexample.com
Bmy-service
Cbackend-service
Dtest.com
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up host names and service names.
5fill in blank
hard

Fill all three blanks to create an NGINX ingress rule that routes traffic to a service on a specific path with TLS enabled.

Kubernetes
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: secure-ingress
  annotations:
    nginx.ingress.kubernetes.io/[1]: "true"
spec:
  tls:
  - hosts:
    - [2]
    secretName: tls-secret
  rules:
  - host: [3]
    http:
      paths:
      - path: /secure
        pathType: Prefix
        backend:
          service:
            name: secure-service
            port:
              number: 443
Drag options to blanks, or click blank then click option'
Assl-redirect
Bsecure.example.com
Denable-tls
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong annotation keys or mismatched host names.