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 the LOG_LEVEL and ENABLE_CONNECTION environment variables from a ConfigMap named app-config. Name the file as pod.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 to INFO and ENABLE_CONNECTION set to No. Name the file as configmap.yaml:
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
log-level: "INFO"
enable-connection: "No"...