Following are the activity solutions for this chapter.
Chapter 1: Kubernetes Design Patterns
Activity: Running a Web Server with Synchronization
In the sidecar.yaml file, pod definition with two containers, namely server and sync, is provided. In the server container, httpd serves the source volume on port 80. In the sync container, git runs with every 30 seconds to synchronize the source volume. These two containers work independently; however, they are sharing the source volume to achieve file synchronization:
apiVersion: v1
kind: Pod
metadata:
name: sidecar
spec:
containers:
...
volumes:
- emptyDir: {}
name: source
Follow these steps to get the solution:
- Create the pod with the following command:
kubectl apply...