Kcna Kubernetes And Cloud Native Associate · Free Practice Question Medium
Question 18
You are responsible for implementing a CI/CD pipeline for a Kubernetes-based application. You need to ensure that each code push to the main branch not only builds and tests the code but also deploys it to a temporary namespace for acceptance testing. After the acceptance test, the temporary namespace should be deleted. What's the best way to achieve this?
-
A
Use a Kubernetes Job to handle the acceptance tests and delete the namespace afterward.
-
B
Use a multi-stage pipeline where one stage deploys to a dynamically generated namespace and another stage deletes it post-testing.
-
C
Create a Helm chart that deploys the application and the acceptance tests, and include logic to delete the namespace upon test completion.
-
D
Configure the pipeline to deploy to the default namespace and use label selectors to distinguish temporary deployments.
Reveal correct answer
Correct answer: B
A.
A Kubernetes Job is meant for one-off tasks and wouldn't be the best way to manage a CI/CD pipeline.
B.
A multi-stage pipeline allows you to define each aspect of the process clearly, including namespace creation for temporary deployments and its deletion post-acceptance testing.
C.
Helm charts are powerful but would require external triggering for namespace deletion, making it less ideal for this scenario.
D.
Using the default namespace for temporary deployments could risk collisions or misconfigurations.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
