Sunday, June 5, 2016

Learning "KUBERNETES"

Learning "KUBERNETES"

Kubernetes is derived from "κυβερνήτης" (kubernetes) is Greek for "pilot" or "helmsman of ship".
Think of Pilot as "Kubernetes" & the Containers (Docker) as Engines managed by Kubernetes.

Kubernetes is a powerful system, developed by Google, for managing containerized applications in a clustered environment, provides better ways of managing related, distributed components across varied infrastructure.

Understanding Terminology:
Master: 
   - Master is the central control point that provides a unified view of the cluster. There is a single  
      master node that control multiple minions or nodes.
   - Master server serves as the main management contact point for administrators, and it provides
      many cluster-wide systems for the relatively dumb worker nodes.
   - Master server runs a number of unique services that are used to manage the cluster's workload
     and direct communications across the nodes.
Minions or Nodes: 
   - Minion is a worker node that run tasks as delegated by the master. Minions can run one or more
      pods. It provides an application-specific "virtual host” in a containerized environment.
Pods:
   - Pods are the smallest deployable units that can be created, scheduled, and managed. Its a logical
     collection of containers that belong to an application.
   - Group of closely-related containers on the same host.
   - Kubernetes pods come and go, if one of them shuts down or crashes, a new pod will be started.
      When scaling up or down or when doing rolling upates pods are created or destroyed.
Kubelet: 
   - Kubelet is the primary “node agent” that runs on each node.
   - The kubelet works in terms of a PodSpec. A PodSpec is a YAML or JSON object that
      describes a pod.
   - The kubelet takes a set of PodSpecs and ensures that the described containers are
      running and healthy.
Replication Controller: 
   - Creates & Destroys PODS dynamically.
   - Defines pods to be horizontally scaled.
   - Uses a label query for identifying what containers to run.
   - Maintains a specific number of replicas of a particular thing to run.
Etcd: 
   - Etcd is a component that kubernetes needs to function as a globally available configuration store.
   - Etcd is lightweight, distributed key-value store that can be distributed across multiple nodes.
   - To store data that can be used by each of the nodes in the cluster. 
Kubectl:
   - Command Line Utility
   - To manage clusters, kubectl authenticates to REST API.
   -  Kubectl controls the Kubernetes cluster manager.
Service: 
    - MVirtual abstraction.
    - Basic load balancer.
    - Single consistent access point to the pod.

Label: 
    - Key value tag to mark work, units a part of group.
    - Management and action targeting.

Definition File:
    - YAML/ JSON describing a pod, service or replication controller. 

KUBERNETES COMMANDS:
kubectl annotate       - Update the annotations on a resource
kubectl api-versions - Print the supported API versions on the server, in the form of “group/version”.
kubectl apply           - Apply a configuration to a resource by filename or stdin
kubectl attach          - Attach to a running container.
kubectl autoscale      - Auto-scale a deployment or replication controller
kubectl cluster-info  - Display cluster info
kubectl config         - config modifies kubeconfig files
kubectl convert        - Convert config files between different API versions
kubectl cordon        - Mark node as unschedulable
kubectl create          - Create a resource by filename or stdin
kubectl delete          - Delete resources by filenames, stdin, resources and names, or by resources
                                    and label selector.
kubectl describe       - Show details of a specific resource or group of resources
kubectl drain           - Drain node in preparation for maintenance
kubectl edit             - Edit a resource on the server
kubectl exec            - Execute a command in a container.
kubectl explain         - Documentation of resources.
kubectl expose         - Take a replication controller, service or pod and expose it as a new
                                    Kubernetes Service.
kubectl get - Display one or many resources
kubectl label - Update the labels on a resource
kubectl logs - Print the logs for a container in a pod.
kubectl patch - Update field(s) of a resource using strategic merge patch.
kubectl proxy - Run a proxy to the Kubernetes API server
kubectl replace - Replace a resource by filename or stdin.
kubectl rollout - rollout manages a deployment
kubectl run - Run a particular image on the cluster.
kubectl scale - Set a new size for a Replication Controller, Job, or Deployment.
kubectl uncordon - Mark node as schedulable
kubectl version - Print the client and server version information.
kubectl namespace - SUPERSEDED: Set and view the current Kubernetes namespace
kubectl port-forward   - Forward one or more local ports to a pod.
kubectl rolling-update - Perform a rolling update of the given ReplicationController.

KUBERNETES ARCHITECTURE