CKS · Question #81
You must complete securing access to a web server using SSL files stored in a TLS Secret. Create a TLS Secret named clever-cactus in the clever-cactus namespace for an existing Deployment named…
This question tests the ability to create a Kubernetes TLS Secret from existing SSL certificate and key files so that a pre-configured Deployment can mount it for HTTPS/SSL termination. The candidate must use the correct secret type and namespace without touching the existing…
Question
Explanation
This question tests the ability to create a Kubernetes TLS Secret from existing SSL certificate and key files so that a pre-configured Deployment can mount it for HTTPS/SSL termination. The candidate must use the correct secret type and namespace without touching the existing workload.
Approach. The correct approach is to run: kubectl create secret tls clever-cactus --cert=/home/candidate/clever-cactus/web.k8s.local.crt --key=/home/candidate/clever-cactus/web.k8s.local.key --namespace=clever-cactus. This command creates a Secret of type kubernetes.io/tls, which stores the certificate under the key tls.crt and the private key under tls.key - the exact keys that Kubernetes (and most ingress controllers) expect. Specifying --namespace=clever-cactus is critical: a Secret is namespaced, and the Deployment referencing it must be in the same namespace. Because the Deployment is already configured to reference this secret by name, simply creating the secret with the exact name clever-cactus in the correct namespace is sufficient for the pod to mount it and establish SSL.
Concept tested. Creating Kubernetes TLS Secrets (kubectl create secret tls) from existing SSL certificate and key files, with correct namespace scoping, so that a pre-existing Deployment can consume the secret for SSL/TLS termination without requiring Deployment modification.
Reference. https://kubernetes.io/docs/concepts/configuration/secret/#tls-secrets
Topics
Community Discussion
No community discussion yet for this question.