Chapter 8: Troubleshooting Applications in Kubernetes
Activity 9: Troubleshooting an Application in Kubernetes
Solution:
Perform the following steps to complete this activity:
- Create a Pod definition file that uses the
suakbas/chapter08:v1
image and is consuming theLOG_LEVEL
andENABLE_CONNECTION
environment variables from a ConfigMap namedapp-config
. Name the file aspod.yaml
:apiVersion: v1 kind: Pod metadata: name: app spec: containers: - name: app image: suakbas/lesson08:v1 env: - name: LOG_LEVEL valueFrom: configMapKeyRef: name: app-config key: log-level - name: ENABLE_CONNECTION valueFrom: configMapKeyRef: name: app-config key: enable-connection
- Create a ConfigMap with the
LOG_LEVEL
field set toINFO
andENABLE_CONNECTION
set toNo
. Name the file asconfigmap.yaml
:apiVersion: v1 kind: ConfigMap metadata: name: app-config data: log-level: "INFO...