Bird
Raised Fist0
Kubernetesdevops~20 mins

Service mesh concept overview in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Service Mesh Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary role of a service mesh in Kubernetes?

Choose the best description of what a service mesh does in a Kubernetes environment.

AIt stores container images and manages image versions for deployments.
BIt schedules pods onto nodes based on resource availability and affinity rules.
CIt manages network traffic between microservices, providing features like load balancing, security, and observability.
DIt monitors CPU and memory usage of nodes and automatically scales the cluster size.
Attempts:
2 left
💡 Hint

Think about what helps microservices communicate securely and reliably inside Kubernetes.

💻 Command Output
intermediate
2:00remaining
Output of Istio sidecar injection command

What is the output when you run the following command to label a namespace for automatic Istio sidecar injection?

kubectl label namespace default istio-injection=enabled
Anamespace/default labeled
BError from server (NotFound): namespaces "default" not found
CWarning: label istio-injection already exists
Dnamespace/default created
Attempts:
2 left
💡 Hint

Labeling a namespace adds a label; it does not create or delete namespaces.

❓ Configuration
advanced
3:00remaining
Correct YAML snippet for enabling mutual TLS in Istio

Which YAML snippet correctly enables mutual TLS (mTLS) for all services in the default namespace using Istio PeerAuthentication?

A
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
  name: default
  namespace: default
spec:
  mtls:
    mode: STRICT
B
apiVersion: security.istio.io/v1alpha1
kind: PeerAuthentication
metadata:
  name: default
  namespace: default
spec:
  mtls:
    enabled: true
C
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
  name: default
  namespace: default
spec:
  trafficPolicy:
    tls:
      mode: ISTIO_MUTUAL
D
apiVersion: security.istio.io/v1beta1
kind: AuthorizationPolicy
metadata:
  name: default
  namespace: default
spec:
  rules:
  - from:
    - source:
        principals: ["*"]
Attempts:
2 left
💡 Hint

Look for the correct apiVersion and kind that configures mTLS mode strictly.

❓ Troubleshoot
advanced
3:00remaining
Troubleshooting failed service-to-service communication in a service mesh

You deployed two microservices in Kubernetes with Istio service mesh enabled. Service A cannot reach Service B. Which of the following is the most likely cause?

AThe cluster's DNS server is down, so pod names cannot be resolved.
BService B's pod does not have the Istio sidecar proxy injected.
CService A's container image is outdated and missing dependencies.
DThe Kubernetes node running Service A is out of disk space.
Attempts:
2 left
💡 Hint

In a service mesh, communication depends on sidecar proxies intercepting traffic.

✅ Best Practice
expert
3:00remaining
Best practice for securing service-to-service communication in a service mesh

Which practice is considered best for securing communication between microservices in a service mesh?

AUse plain HTTP for internal services and HTTPS only for external traffic.
BDisable encryption to reduce latency and rely on network firewalls only.
CManually configure IP whitelists for each service instead of using mesh policies.
DEnable mutual TLS (mTLS) with strict mode and rotate certificates regularly.
Attempts:
2 left
💡 Hint

Think about encryption and automated security features in service meshes.

Practice

(1/5)
1. What is the main purpose of a service mesh in Kubernetes?
easy
A. To manage communication between services securely and reliably
B. To store data persistently for applications
C. To schedule pods on nodes
D. To build container images automatically

Solution

  1. Step 1: Understand service mesh role

    A service mesh manages how services communicate with each other, focusing on security and reliability.
  2. Step 2: Compare options

    Options B, C, and D relate to storage, scheduling, and building images, which are not service mesh functions.
  3. Final Answer:

    To manage communication between services securely and reliably -> Option A
  4. Quick Check:

    Service mesh = secure, reliable service communication [OK]
Hint: Service mesh controls service communication, not storage or scheduling [OK]
Common Mistakes:
  • Confusing service mesh with storage or scheduling tools
  • Thinking service mesh builds container images
  • Assuming service mesh replaces Kubernetes itself
2. Which component is typically deployed alongside an application pod to enable a service mesh?
easy
A. A sidecar proxy
B. A persistent volume
C. A Kubernetes scheduler
D. A container registry

Solution

  1. Step 1: Identify service mesh architecture

    Service meshes use sidecar proxies deployed with app pods to intercept and manage traffic.
  2. Step 2: Eliminate unrelated components

    Persistent volumes store data, schedulers assign pods to nodes, and container registries store images, none manage traffic.
  3. Final Answer:

    A sidecar proxy -> Option A
  4. Quick Check:

    Sidecar proxy = service mesh traffic manager [OK]
Hint: Sidecar proxies run with pods to manage traffic [OK]
Common Mistakes:
  • Confusing sidecar proxy with storage or scheduling components
  • Thinking service mesh requires changes inside app code
  • Assuming container registry is part of service mesh
3. Given a Kubernetes cluster with a service mesh installed, what happens when one service calls another?
medium
A. The call is converted into a database query
B. The call bypasses the sidecar and goes directly to the service
C. The service mesh blocks all calls by default
D. The call is routed through the sidecar proxy which handles retries and security

Solution

  1. Step 1: Understand service mesh traffic flow

    Service mesh sidecars intercept calls between services to add features like retries and security.
  2. Step 2: Evaluate options

    The call bypasses the sidecar and goes directly to the service is incorrect because calls do not bypass sidecars. The service mesh blocks all calls by default is wrong; calls are allowed with policies. The call is converted into a database query is unrelated.
  3. Final Answer:

    The call is routed through the sidecar proxy which handles retries and security -> Option D
  4. Quick Check:

    Service calls go through sidecar proxy [OK]
Hint: Service mesh sidecar proxies manage calls with retries and security [OK]
Common Mistakes:
  • Assuming calls bypass the service mesh
  • Thinking service mesh blocks all traffic
  • Confusing service calls with database queries
4. You deployed a service mesh but notice that traffic between services is not being intercepted. What is a likely cause?
medium
A. The pods have no CPU resources assigned
B. The sidecar proxy was not injected into the pods
C. The container images are missing
D. The Kubernetes API server is down

Solution

  1. Step 1: Identify why traffic is not intercepted

    Service mesh requires sidecar proxies injected into pods to intercept traffic.
  2. Step 2: Rule out unrelated issues

    Kubernetes API server down or missing images cause broader failures, not just traffic interception. CPU limits affect performance but not injection.
  3. Final Answer:

    The sidecar proxy was not injected into the pods -> Option B
  4. Quick Check:

    Missing sidecar = no traffic interception [OK]
Hint: Check if sidecar proxy is injected in pods [OK]
Common Mistakes:
  • Blaming Kubernetes API server for traffic interception issues
  • Ignoring sidecar injection step
  • Assuming CPU limits block traffic interception
5. You want to add fine-grained traffic control between services in your Kubernetes cluster. How does a service mesh help achieve this?
hard
A. By replacing Kubernetes networking with a custom network plugin
B. By modifying the application source code to handle traffic rules
C. By using sidecar proxies to route, split, and secure traffic without changing app code
D. By storing traffic rules in a database external to the cluster

Solution

  1. Step 1: Understand service mesh traffic control features

    Service meshes use sidecar proxies to manage traffic routing, splitting, and security transparently.
  2. Step 2: Evaluate other options

    By modifying the application source code to handle traffic rules requires app code changes, which service mesh avoids. By replacing Kubernetes networking with a custom network plugin is about networking plugins, not service mesh. By storing traffic rules in a database external to the cluster is unrelated to traffic control mechanisms.
  3. Final Answer:

    By using sidecar proxies to route, split, and secure traffic without changing app code -> Option C
  4. Quick Check:

    Sidecar proxies enable traffic control without app changes [OK]
Hint: Service mesh controls traffic via sidecars, no app code changes needed [OK]
Common Mistakes:
  • Thinking app code must be changed for traffic control
  • Confusing service mesh with network plugins
  • Assuming traffic rules are stored externally
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard