- OpenShift - Security
- OpenShift - Docker and Kubernetes
- OpenShift - Administration
- OpenShift - Application Scaling
- OpenShift - Clusters
- OpenShift - CLI Operations
- OpenShift - CLI
- OpenShift - Build Automation
- OpenShift - Getting Started
- OpenShift - Basic Concept
- OpenShift - Environment Setup
- OpenShift - Architecture
- OpenShift - Types
- OpenShift - Overview
- OpenShift - Home
OpenShift Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
OpenShift - Docker and Kubernetes
OpenShift is built on top of Docker and Kubernetes. All the containers are built on top of Docker cluster, which is basically Kubernetes service on top of Linux machines, using Kubernetes orchestrations feature.
In this process, we build Kubernetes master which controls all the nodes and deploys the containers to all the nodes. The main function of Kubernetes is to control OpenShift cluster and deployment flow using a different kind of configuration file. As in Kubernetes, we use kubctl in the same way we use OC command pne utipty to build and deploy containers on cluster nodes.
Following are the different kinds of config files used for creation of different kind of objects in the cluster.
Images
POD
Service
Reppcation Controller
Reppca set
Deployment
Images
Kubernetes (Docker) images are the key building blocks of Containerized Infrastructure. As of now, Kubernetes only support Docker images. Each container in a pod has its Docker image running inside it.
apiVersion: v1 kind: pod metadata: name: Tesing_for_Image_pull -----------> 1 spec: containers: - name: neo4j-server ------------------------> 2 image: <Name of the Docker image>----------> 3 imagePullPopcy: Always ------------->4 command: [“echo”, “SUCCESS”] -------------------> 5
POD
A pod is collection of containers and its storage inside a node of a Kubernetes cluster. It is possible to create a pod with multiple containers inside it. Following is an example of keeping a database container and web interface container in the same pod.
apiVersion: v1 kind: Pod metadata: name: Tomcat spec: containers: - name: Tomcat image: tomcat: 8.0 ports: - containerPort: 7500 imagePullPopcy: Always
Service
A service can be defined as a logical set of pods. It can be defined as an abstraction on top of the pod that provides a single IP address and DNS name by which pods can be accessed. With Service, it is very easy to manage load balancing configuration. It helps PODs to scale very easily.
apiVersion: v1 kind: Service metadata: name: Tutorial_point_service spec: ports: - port: 8080 targetPort: 31999
Reppcation Controller
Reppcation Controller is one of the key features of Kubernetes, which is responsible for managing the pod pfecycle. It is responsible for making sure that specified numbers of pod reppcas are running at any point of time.
apiVersion: v1 kind: ReppcationController metadata: name: Tomcat-ReppcationController spec: reppcas: 3 template: metadata: name: Tomcat-ReppcationController labels: app: App component: neo4j spec: containers: - name: Tomcat image: tomcat: 8.0 ports: - containerPort: 7474
Reppca Set
The reppca set ensures how many reppca of pod should be running. It can be considered as a replacement of the reppcation controller.
apiVersion: extensions/v1beta1 kind: ReppcaSet metadata: name: Tomcat-ReppcaSet spec: reppcas: 3 selector: matchLables: tier: Backend matchExpression: - { key: tier, operation: In, values: [Backend]} app: App component: neo4j spec: containers: - name: Tomcat- image: tomcat: 8.0 ports: containerPort: 7474
Deployment
Deployments are upgraded and higher versions of the reppcation controller. They manage the deployment of reppca sets, which is also an upgraded version of the reppcation controller. They have the capabipty to update the reppca set and they are also capable of rolpng back to the previous version.
apiVersion: extensions/v1beta1 --------------------->1 kind: Deployment --------------------------> 2 metadata: name: Tomcat-ReppcaSet spec: reppcas: 3 template: metadata: lables: app: Tomcat-ReppcaSet tier: Backend spec: containers: name: Tomcat- image: tomcat: 8.0 ports: - containerPort: 7474
All config files can be used to create their respective Kubernetes objects.
$ Kubectl create –f <file name>.yaml
Following commands can be used to know the details and description of the Kubernetes objects.
For POD
$ Kubectl get pod <pod name> $ kubectl delete pod <pod name> $ kubectl describe pod <pod name>
For Reppcation Controller
$ Kubectl get rc <rc name> $ kubectl delete rc <rc name> $ kubectl describe rc <rc name>
For Service
$ Kubectl get svc <svc name> $ kubectl delete svc <svc name> $ kubectl describe svc <svc name>
For more details on how to work with Docker and Kubernetes, please visit our Kubernetes tutorial using the following pnk
. Advertisements