Kubernetes Mastery

Develop and Deploy Cloud Native Applications at Scale

Extra Practice (Grade Submission API)

Key Takeaways

Kubernetes is a container orchestration platform that coordinates the collaboration of Master Nodes and Worker Nodes. Master Nodes (Control Plane) are responsible for scheduling and deciding where applications run. Worker Nodes provide the infrastructure to actually run the applications. In a single-node cluster, your computer plays the role of Master and Worker Node.

Containers

Containers run applications in isolation with their dependencies, making them highly portable.

Pods

In Kubernetes, pods are the smallest deployable units and encapsulate application containers.

Pod Configuration

  1. Metadata:
    • Name: Uniquely identifies the pod
    • Labels: Categorize pods into distinct groups for flexible querying
  2. Runtime Requirements (specified under 'spec'):
    • Container name
    • Image source
    • Port for serving requests
    • Resource requirements (CPU and memory)
      • Memory limit and request should be the same
      • CPU limit should rarely be set (as per Kubernetes best practices)

Multi-Container Pods

Pods can run multiple containers, enabling sidecar patterns where auxiliary sidecar containers can communicate with the main application container via localhost.

Port Forwarding in Kubernetes

Port forwarding creates a temporary connection between your local machine and a pod in the cluster. It's primarily used for debugging and testing purposes. The command structure is:  kubectl port-forward <pod-name> <local-port>:<pod-port>. For example, kubectl port-forward mypod 8080:80 forwards local port 8080 to port 80 of the pod.