Sidecar Pattern
3.5 Sidecar Pattern
Example YAML configuration for the sidecar pattern. It defines a main application container which writes the current date to a log file every five seconds. The sidecar container is nginx serving that log file.
In practice, your sidecar is likely to be a log collection container that uploads to external storage
Sidecar Pattern - Scenario 1
Step 1: Run the Pod Manifest file
kubectl apply -f sidecar-pattern.yamlEnsure Once the pod is running
Step 2: Connect to the sidecar pod and Access the log file via the sidecar
kubectl exec pod-with-sidecar -c busyboxplus -it -- curl http://localhost:80/app.txtSidecar Pattern - Scenario 2 ( Feel free to Experiment , you need to troubleshoot )
Step 1: Expose the Service for 2048App
kubectl apply -f expose-sidecar.yamlStep 2: Run the Pod Manifest file
kubectl apply -f sidecar-git-sync.yamlEnsure Once the pod is running
Step 3: Verify on which worker node the pod is running.
kubectl get pods -o wideStep 4: Verify the port using the Service Command
Step 4: Browse the Node IP with the above mentioned port
You should be able to see 2048 Game App Loaded in your Browser
Clear Pods,Deployments,Services
Delete all Pods
Delete all Deployments
Delete all Services
Clear Everything in the current namespace
Last updated
Was this helpful?