Kubernetes (k8s) is an open-source system for automating deployment, scaling, and management of containerized applications.
You should know the following concepts before starting to work with K8s :
A container is the smallest unit in the Kubernetes world. The main purpose of Kubernetes is to manage, deploy, and, to a certain extent, monitor containers. Kubernetes management is not limited to Docker containers.
A node is the host that the container runs on.
A pod is a management unit in Kubernetes comprised of one or more containers. Each pod has its own unique IP address and storage namespaces. All containers share these networking and storage resources. One of the characteristics mentioned in this presentation is that pods are “mortal.” This means when a pod is deleted, it is gone for good. A YAML (Yet Another Markup Language) file is used to define a Pod. Here is a sample copy of a YAML file representing a Pod:
<code> apiVersion: v1 kind: Pod metadata: name: nginx-pod labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 </code>
A Deployment is a new way to handle High Availability (HA) in Kubernetes in place of the Replication Controller. A pod by itself is “mortal” but with a Deployment, Kubernetes can make sure that the number of Pods that a user specifies is always up and running in the system. A Deployment specifies how many instances of a pod will run. A YAML file is used to define a Deployment. Here is an example of a YAML file representing a Deployment:
<code> apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nginx-deployment spec: replicas: 2 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.7.9 </code>
According to the official Kubernetes website, “A Kubernetes Service is an abstraction which defines a logical set of Pods and a policy by which to access them – sometimes called a micro-service.”
Luke discussed the concept of Cluster IP and NodePorts. Cluster IP is internal to Kubernetes, and the NodePorts are the published IP addresses for external users to access the services. Routes to services are based on labels. As with Pods and Deployments, a service is also defined by a YAML file.
This diagram from the presentation puts the Service YAML file and the Deployment YAML file side by side. Note the arrow that makes it easy to see that a Service is connected to a Deployment via the label attribute. In this case, the label is nginx.
Credit : weaveworks