Key components: Master, Node, Pods, Services.

Category : Kubernetes | Sub Category : Learn Kubernetes | By Prasad Bonam Last updated: 2023-11-22 07:12:19 Viewed : 226


Key components: Master, Node, Pods, Services.

lets delve into the key components of Kubernetes: Master, Node, Pods, and Services.

  1. Master:

    • The master node is the control plane of the Kubernetes cluster. It manages the overall state and orchestration of the cluster.

    • Components:

      • API Server: Exposes the Kubernetes API. It is the front end of the control plane and the only component that interacts with the etcd cluster to persist the state of the cluster.
      • Controller Manager: Ensures the desired state of the cluster by running controller processes (e.g., ReplicaSet Controller, Endpoint Controller).
      • Scheduler: Assigns pods to nodes based on resource requirements and constraints.
    • Example:

      • Deploying a pod using the kubectl command involves interacting with the API server. For example:
        bash
        kubectl create deployment my-deployment --image=my-image
  2. Node (Minion):

    • A node is a worker machine in Kubernetes, responsible for running containers and providing the runtime environment.

    • Components:

      • Kubelet: Ensures that containers are running in a pod on the node.
      • Container Runtime: Software responsible for running containers (e.g., Docker, containerd).
      • Kube Proxy: Maintains network rules on the host and enables communication between pods.
    • Example:

      • Deploying a pod to a node involves the Kubelet interacting with the container runtime. For example:
        yaml
        apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: my-container image: my-image
  3. Pods:

    • The smallest and simplest unit in the Kubernetes object model. A pod represents a single instance of a running process in a cluster.

    • Characteristics:

      • Pods can have one or more containers sharing the same network namespace.
      • Containers in a pod share storage volumes.
      • Pods are the basic deployable units in Kubernetes.
    • Example:

      • Defining a pod with two containers:
        yaml
        apiVersion: v1 kind: Pod metadata: name: my-pod spec: containers: - name: container-1 image: image-1 - name: container-2 image: image-2
  4. Services:

    • Services define a set of pods and a policy by which to access them, providing a stable endpoint for communication.

    • Types:

      • ClusterIP: Exposes the service on an internal IP within the cluster.
      • NodePort: Exposes the service on a static port on each nodes IP.
      • LoadBalancer: Creates an external load balancer and assigns a unique external IP.
    • Example:

      • Creating a service to expose a set of pods:
        yaml
        apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app: my-app ports: - protocol: TCP port: 80 targetPort: 8080

Understanding these key components is fundamental to working effectively with Kubernetes. The master controls the cluster, nodes run containers, pods encapsulate containers, and services enable communication between pods.


Search
Related Articles

Leave a Comment: