Bootstrap FreeKB - OpenShift - Deploy a pod from a JSON or YAML file
OpenShift - Deploy a pod from a JSON or YAML file

Updated:   |  OpenShift articles

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

An image contains the code used to create a pod.The deployment YAML configuration file will specify the number of replicas which is the number of pods that should be created for the deployment.

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get images command can be used to list the images in your registry. In this example, the image for version 118 of NGINX for Red Hat Enterprise Linux 8 (rhel8) is listed.

~]# oc get images
NAME                                                                      IMAGE REFERENCE
sha256:b0c3c1535819ebbc8fe00b79cd74d88702d1bd74a5348a30b2fa849a637ecac6   registry.redhat.io/rhel8/nginx-118@sha256:b0c3c1535819ebbc8fe00b79cd74d88702d1bd74a5348a30b2fa849a637ecac6

 

Here is an example of the minimum markup needed in a YAML file to create a pod. Notice that the image key contains the IMAGE REFERENCE.

apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
  - name: nginx-container
    image: registry.redhat.io/rhel8/nginx-118@sha256:b0c3c1535819ebbc8fe00b79cd74d88702d1bd74a5348a30b2fa849a637ecac6

 

Let's say your YAML file is named nginx.yml. The oc create or oc apply command can be used to create the pod. In this scenario, a deployment or deploymentconfig would not be created.

~]# oc create --filename nginx.json
pod/nginx created

 

The oc get pods command can then be used to see if the pod is running.

~]$ oc get pods
NAME     READY   STATUS     RESTARTS   AGE
nginx    1/1     Running    0          3m23s

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 59bb02 in the box below so that we can be sure you are a human.