0
0
Kubernetesdevops~30 mins

Sidecar proxy concept (Envoy) in Kubernetes - Mini Project: Build & Apply

Choose your learning style9 modes available
Sidecar Proxy Concept with Envoy in Kubernetes
📖 Scenario: You are working in a Kubernetes environment where you want to add a sidecar proxy to your application pod. This proxy will help manage network traffic for your app securely and efficiently.Envoy is a popular sidecar proxy used in service meshes. In this project, you will create a simple Kubernetes pod manifest that includes an Envoy sidecar container alongside your main application container.
🎯 Goal: Build a Kubernetes pod manifest YAML file that defines a pod with two containers: one for your application and one for the Envoy sidecar proxy. This setup will help you understand how sidecar proxies work in Kubernetes.
📋 What You'll Learn
Create a Kubernetes pod manifest named pod.yaml.
Define a pod with metadata name app-with-envoy.
Add two containers: app-container running nginx image and envoy-proxy running envoyproxy/envoy:v1.22.0 image.
Configure the Envoy container with a volume mount for its configuration file.
Add a ConfigMap named envoy-config with a basic Envoy configuration.
Mount the ConfigMap as a volume in the Envoy container.
💡 Why This Matters
🌍 Real World
Sidecar proxies like Envoy are used in Kubernetes to manage network traffic, add security, and enable observability without changing the application code.
💼 Career
Understanding how to configure sidecar proxies is essential for roles in cloud engineering, DevOps, and site reliability engineering where managing microservices traffic is common.
Progress0 / 4 steps
1
Create the basic pod manifest with the app container
Create a Kubernetes pod manifest file named pod.yaml with a pod named app-with-envoy. Add a single container named app-container using the image nginx.
Kubernetes
Need a hint?

Start with apiVersion: v1 and kind: Pod. Under spec, add containers list with one container named app-container using nginx image.

2
Add the Envoy sidecar container with volume mount
In the same pod.yaml, add a second container named envoy-proxy using the image envoyproxy/envoy:v1.22.0. Mount a volume named envoy-config-volume at /etc/envoy inside the Envoy container.
Kubernetes
Need a hint?

Under containers, add the Envoy container with volumeMounts. Then add volumes section referencing the ConfigMap envoy-config.

3
Create the Envoy ConfigMap with basic configuration
Create a ConfigMap named envoy-config with a key envoy.yaml containing a minimal Envoy configuration that listens on port 10000 and routes traffic to localhost:80.
Kubernetes
Need a hint?

Use apiVersion: v1 and kind: ConfigMap. Add envoy.yaml key with a minimal Envoy config that listens on port 10000 and routes to localhost port 80.

4
Display the pod manifest and ConfigMap to verify
Print the contents of pod.yaml and the Envoy ConfigMap to verify your setup. Use kubectl apply -f pod.yaml --dry-run=client -o yaml and kubectl get configmap envoy-config -o yaml commands.
Kubernetes
Need a hint?

Use kubectl apply -f pod.yaml --dry-run=client -o yaml to see the pod manifest and kubectl get configmap envoy-config -o yaml to see the ConfigMap.