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.yaml
Ensure 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.txt
Sidecar Pattern - Scenario 2 ( Feel free to Experiment , you need to troubleshoot )
Step 1: Expose the Service for 2048App
kubectl apply -f expose-sidecar.yaml
Step 2: Run the Pod Manifest file
kubectl apply -f sidecar-git-sync.yaml
Ensure Once the pod is running
Step 3: Verify on which worker node the pod is running.
kubectl get pods -o wide
Step 4: Verify the port using the Service Command
kubectl get svc
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
kubectl delete --all pods --namespace=default
Delete all Deployments
kubectl delete --all deployments --namespace=default
Delete all Services
kubectl delete --all svc --namespace=default
Clear Everything in the current namespace
kubectl delete all --all -n default
Last updated
Was this helpful?