Bird
Raised Fist0
Kubernetesdevops~20 mins

TLS termination with Ingress in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
TLS Ingress Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What is TLS termination in Kubernetes Ingress?

In Kubernetes, what does TLS termination mean when used with an Ingress resource?

AThe Ingress controller decrypts incoming TLS traffic and forwards unencrypted traffic to backend services.
BTLS termination means encrypting traffic between backend services and the Ingress controller.
CThe backend services handle TLS decryption and encryption directly without Ingress involvement.
DTLS termination disables TLS encryption entirely for all traffic in the cluster.
Attempts:
2 left
💡 Hint

Think about where the encrypted traffic is decrypted in the flow from client to backend.

❓ Configuration
intermediate
2:00remaining
Identify the correct TLS section in an Ingress manifest

Which TLS configuration snippet correctly enables TLS termination for the host example.com in a Kubernetes Ingress manifest?

A
tls:
  hosts: example.com
  secretName: example-tls
B
tls:
  - hosts:
    - example.com
    secretName: example-tls
C
tls:
  - host: example.com
    secretName: example-tls
D
tls:
  - hosts:
    - example.com
    secret: example-tls
Attempts:
2 left
💡 Hint

Check the indentation and key names carefully for the TLS section.

💻 Command Output
advanced
1:30remaining
What is the output of describing an Ingress with TLS configured?

Given an Ingress resource with TLS configured for example.com, what will kubectl describe ingress my-ingress show under the TLS section?

A
TLS:
  example.com -> example-tls
B
TLS:
  example.com, secretName: example-tls
C
TLS:
  example.com terminates at secret example-tls
D
TLS:
  Hosts: example.com
  SecretName: example-tls
Attempts:
2 left
💡 Hint

Look at the typical output format of kubectl describe ingress for TLS info.

❓ Troubleshoot
advanced
2:00remaining
Why does HTTPS fail despite TLS configured in Ingress?

You configured TLS in your Ingress with a valid secret, but HTTPS requests fail with a connection error. What is the most likely cause?

AThe TLS secret is missing the private key file.
BThe backend service is not listening on port 443.
CThe Ingress controller is not running or not configured to handle TLS.
DThe Ingress resource is missing the <code>spec.rules</code> section.
Attempts:
2 left
💡 Hint

Think about what component handles TLS termination and if it is active.

✅ Best Practice
expert
2:30remaining
Best practice for securing backend services with TLS after Ingress termination

After TLS termination at the Ingress controller, what is the best practice to secure traffic between the Ingress controller and backend services?

AUse mutual TLS (mTLS) between the Ingress controller and backend services to encrypt traffic internally.
BSend plain HTTP traffic from Ingress to backend services to reduce latency.
CDisable TLS on backend services since Ingress already handles encryption.
DUse IP whitelisting on backend services instead of encryption.
Attempts:
2 left
💡 Hint

Consider how to protect traffic inside the cluster after TLS termination.

Practice

(1/5)
1. What is the main purpose of TLS termination in a Kubernetes Ingress?
easy
A. To monitor network traffic for security threats
B. To encrypt traffic between backend services
C. To generate TLS certificates automatically
D. To decrypt HTTPS traffic at the Ingress before forwarding to backend services

Solution

  1. Step 1: Understand TLS termination role

    TLS termination means decrypting encrypted HTTPS traffic at a central point.
  2. Step 2: Identify Ingress function

    Kubernetes Ingress can handle TLS termination by decrypting traffic before sending it to backend pods.
  3. Final Answer:

    To decrypt HTTPS traffic at the Ingress before forwarding to backend services -> Option D
  4. Quick Check:

    TLS termination = decrypt at Ingress [OK]
Hint: TLS termination means decrypting at Ingress, not backend [OK]
Common Mistakes:
  • Confusing TLS termination with encryption between services
  • Thinking Ingress generates certificates automatically
  • Assuming TLS termination monitors traffic
2. Which of the following is the correct way to specify TLS in a Kubernetes Ingress YAML?
easy
A. tls: - hosts: - example.com secret: tls-secret
B. tls: - hosts: - example.com secretName: tls-secret
C. tls: - host: example.com secret: tls-secret
D. tls: hosts: example.com secretName: tls-secret

Solution

  1. Step 1: Review TLS section syntax

    The correct syntax uses a list under tls with hosts as a list and secretName key.
  2. Step 2: Compare options

    tls: - hosts: - example.com secretName: tls-secret matches the correct YAML structure with 'secretName' and hosts list.
  3. Final Answer:

    tls: - hosts: - example.com secretName: tls-secret -> Option B
  4. Quick Check:

    Correct TLS YAML uses secretName and hosts list [OK]
Hint: Use 'secretName' and list under 'hosts' in tls section [OK]
Common Mistakes:
  • Using 'secret' instead of 'secretName'
  • Not using a list for hosts
  • Incorrect indentation or missing dash
3. Given this Ingress snippet:
tls:
  - hosts:
    - myapp.example.com
    secretName: myapp-tls

rules:
  - host: myapp.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: myapp-service
            port:
              number: 80
What happens when a user accesses https://myapp.example.com?
medium
A. The Ingress decrypts TLS and forwards HTTP traffic to myapp-service on port 80
B. The Ingress forwards encrypted TLS traffic directly to myapp-service
C. The Ingress rejects the connection because backend port is 80
D. The Ingress terminates TLS but forwards HTTPS traffic to backend

Solution

  1. Step 1: Understand TLS termination in Ingress

    The Ingress uses the secret to decrypt HTTPS traffic for the host.
  2. Step 2: Check backend service port and protocol

    The backend service listens on port 80 (HTTP), so decrypted HTTP traffic is forwarded.
  3. Final Answer:

    The Ingress decrypts TLS and forwards HTTP traffic to myapp-service on port 80 -> Option A
  4. Quick Check:

    Ingress decrypts TLS, backend gets HTTP [OK]
Hint: Ingress decrypts TLS, backend usually gets HTTP on port 80 [OK]
Common Mistakes:
  • Assuming backend receives encrypted traffic
  • Thinking backend must use HTTPS port
  • Confusing TLS termination with passthrough
4. You configured TLS in your Ingress but HTTPS requests fail with a certificate error. What is the most likely cause?
medium
A. The secret referenced in tls section does not contain a valid TLS certificate
B. The backend service is not listening on port 443
C. The Ingress controller does not support TLS termination
D. The Ingress resource is missing the rules section

Solution

  1. Step 1: Check TLS secret validity

    If the secret does not have a valid TLS cert and key, HTTPS will fail with certificate errors.
  2. Step 2: Verify other options

    Backend port or missing rules do not cause cert errors; controller usually supports TLS.
  3. Final Answer:

    The secret referenced in tls section does not contain a valid TLS certificate -> Option A
  4. Quick Check:

    Invalid TLS secret = cert error [OK]
Hint: Check TLS secret contents first for certificate errors [OK]
Common Mistakes:
  • Blaming backend port for TLS cert errors
  • Assuming Ingress controller lacks TLS support
  • Ignoring TLS secret correctness
5. You want to secure multiple domains with TLS termination using a single Ingress resource. Which approach is correct?
hard
A. Use one tls entry with multiple hosts but different secrets for each host
B. Create separate Ingress resources for each domain with their own TLS secrets
C. Add multiple entries under the tls section with hosts and a single secret containing SAN certificates
D. Configure TLS only on backend services, not on Ingress

Solution

  1. Step 1: Understand TLS with multiple hosts

    A single secret can contain a certificate with multiple Subject Alternative Names (SANs) for multiple domains.
  2. Step 2: Configure Ingress tls section

    The tls field is a list, so add multiple entries under tls, each with a hosts list and referencing the same secretName containing the SAN cert.
  3. Final Answer:

    Add multiple entries under the tls section with hosts and a single secret containing SAN certificates -> Option C
  4. Quick Check:

    Multiple tls entries share SAN secret [OK]
Hint: Multiple tls entries can share one SAN cert secret [OK]
Common Mistakes:
  • Trying different secrets for each host in one tls entry
  • Creating many Ingress resources unnecessarily
  • Not using SAN certificates for multiple domains
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard