In this lab, you will learn how to manage sensitive data, such as passwords, tokens, or keys, within Kubernetes. Additionally, you will configure CPU and memory limits for your application.
6 Points:
-
Create a Secret Using
kubectl
:- Learn about Kubernetes Secrets and create a secret using the
kubectl
command:
- Learn about Kubernetes Secrets and create a secret using the
-
Verify and Decode Your Secret:
- Confirm and decode the secret, then create an
11.md
file within thek8s
folder. Provide the output of the necessary commands inside this file.
- Confirm and decode the secret, then create an
-
Manage Secrets with Helm:
-
Use Helm to manage your secrets.
-
Create a
secrets.yaml
file in thetemplates
folder. -
Define a
secret
object within this YAML file. -
Add an
env
field to yourDeployment
. The path to update is:spec.template.spec.containers.env
.Refer to this Helm Secrets Video for guidance.
-
Update your Helm deployment as instructed in the video.
-
Retrieve the list of pods using the command
kubectl get po
. Use the name of the pod as proof of your success within the report. -
Verify your secret inside the pod, for example:
kubectl exec demo-5f898f5f4c-2gpnd -- printenv | grep MY_PASS
. Share this output in11.md
.
-
-
Create a Pull Request:
- Generate a PR to the main branch of the forked repository.
-
Create a Pull Request in Your Own Repository:
- Create a PR in your repository from the lab11 branch to the main one. This will facilitate the grading process.
4 Points:
-
Install Vault Using Helm Chart:
- Install Vault using a Helm chart. Follow the steps provided in this guide:
-
Follow the Tutorial with Your Helm Chart:
- Adapt the tutorial to work with your Helm chart, including the following steps:
- Set a Secret in Vault
- Configure Kubernetes Authentication
- Be cautious with the service account. If you used
helm create ...
, it will be created automatically. In the guide, they create it manually.
- Adapt the tutorial to work with your Helm chart, including the following steps:
-
Implement Vault Secrets in Your Helm Chart:
- Use the steps from the guide as an example for your Helm chart:
- Test to ensure your credentials are injected successfully. Use the
kubectl exec -it <your_app> -- bash
command to access the container. Verify the injected secrets usingcat /path/to/your/secret
anddf -h
. Share the output in the11.md
report. - Apply a template as described in the guide. Test the updates as you did in the previous step and provide the outputs in
11.md
.
List of Requirements:
- Proof of work with a secret in
11.md
for the Task 1 - steps 2 and 3. secrets.yaml
file.- Resource requests and limits for CPU and memory.
- Vault configuration implemented, with proofs in
11.md
.
2.5 Points:
-
Read About Resource Management:
- Familiarize yourself with resource management in Kubernetes:
-
Set Up Requests and Limits for CPU and Memory for Both Helm Charts:
- Configure resource requests and limits for CPU and memory for your application.
- Test to ensure these configurations work correctly.
-
Add Environment Variables for Your Containers for Both Helm Charts:
- Read about Kubernetes environment variables:
- Update your Helm chart with several environment variables using named templates. Move these variables to the
_helpers.tpl
file:
Guidelines:
- Ensure that your documentation is clear and organized.
- Include all the necessary components.
- Follow appropriate file and folder naming conventions.
- When creating the PR in your repository, make it from the
lab11
branch to the main branch.
Note: Thorough documentation is essential to demonstrate your success in managing secrets and resource allocation in Kubernetes. Explore the bonus tasks to enhance your skills further.