Saturday, December 28, 2024

OpenShift - Part 1

 


OpenShift:
  • OpenShift is provide a platform as service [PaaS]. It is an enterprise product of Kubernetes.
  • OpenShift is a top layer of orchestration ith K8S. K8S will use in the Development or Staging environment and OpenShift will be use in the Production environment.
Container is a light weight, standalone and executable package that includes needed to run a piece of software, libraries or your application codes.
Advantages of Containers:
    * Efficiency - Containers are share the host OS kernel and reducing over head compare to virtual machines.
    * Consistency - Application can run any of the environment irrespective of host OS.
    * Portability - It will portable to any environment and doesn't have any dependencies.
    * Scalability - Containers are scaled up or down easily.
Container components:
    * Container Image - It is a read only template and create along with application and codes.
    * Container -   A running instance from the image.  
    * Registry - It is storing and distributing the images.

Parameter for a Container file creation:

FROM - Sets the base image for the resulting container image. 
WORKDIR - Sets the current working directory with in the container.
COPY and ADD - Copy files from the build host into the file system of the resulting container image. ADD instruction copy a files from URL or untar of file into container image.
RUN - Runs a command in the container and commits with new layer with in the image.
ENTRYPOINT - Sets the executable to run when the container is started. 
CMD - Runs a command when the container has started.  This command is passed to the executable defined by ENTRYPOINT.
LABEL - Add a key pair value to the metadata of the image for organization and image selection.
ENV - Environment variables
ARG - build time variables
Volume - Define a storing data outside of container.


K8S:

Kubernetes is combination of resources such storage, compute and networking.
K8S is not having a container registry by default. [Registry means container images]


K8S will support container such as crio, docker and containerd 
OpenShift will support crio by default.
ssh is restrict into master and worker node from OpenShift 4.0 onwards.

OpenShift 3.x:
Operating System - RHEL/CentOS/Fedora
Allow ssh access to Master and Worker nodes by default.

OpenShift 4.x:
Operating System - RHEL Core O/S

Core OS is means Container Ready OS and It is not mutable.
ssh access is restrict into Master and Worker nodes.

We must setup the SSH key pair for accessing a master and worker nodes, otherwise we must use OC debug node/node name.
#oc debug node/master1
#oc debug node/workernodename
#oc login -u admin -p password API (https://api.hostname.com:6443)

We can check the node status through kubeconfig as well
#oc get nodes --kubeconfig=/home/user/auth/kubeconfig

Logout of current session:
#oc logout


No comments:

Post a Comment