Troubleshooting Secrets in Kubernetes Deployments

45 minutes
  • 2 Learning Objectives

About this Hands-on Lab

You are a container engineer at Cube4Lyf, an e-gaming platform geared towards puzzle and logic games. As their Kubernetes implementation matures, the security team is looking to leverage cluster Secrets to manage sensitive information. For one of their early prototypes, a team has attempted to access credentials for a third-party service as environment Secrets within their containers. However, the engineers report that the container is currently unable to resolve the sensitive values as expected, preventing it from accessing the external service. You will need to examine the configuration of the Secret and the Deployment creating the Pod to fix this issue.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Fix the Configuration Issues in vendor-secret.yaml

Identify and correct the issues in vendor-secret.yaml so that the Secret data maps to an environment variable.

Storing Secrets as an encoded map:

apiVersion: v1
kind: Secret
name: vendor-secret
endpoint: YXBpLmUtc2FsZS5jb20vdjIK   
token: Z3Vlc3NtZWlmeW91Y2FuCg==
Fix the Configuration Issues in application-deployment.yaml

Identify and correct the issues in application-deployment.yaml so that the Secret data maps to an environment variable.

Accessing Secrets as environment variables:

apiVersion: apps/v1
kind: Deployment
name: puzzle-plaza
app: puzzle-plaza
replicas: 1
app: puzzle-plaza
- name: shop-app
image: busybox
command: ['sh', '-c', 'while true; echo "STATUS: UP"; do sleep 3600; done']
- name: ENDPOINT
name: vendor-secret
key: endpoint
- name: TOKEN
name: vendor-secret
key: token

Additional Resources

  • Kubernetes Secrets:
  • Accessing Secrets in Kubernetes:

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?