Thursday 30 June 2022

Create OpenShift Kubernetes Pod Example


 ls

openshift-pod.yaml  openshift1-pod.yaml


 cat openshift-pod.yaml 

apiVersion: v1

kind: Pod

metadata:

  name: mypod1

  labels:

    mycka: round-robin

spec:

  containers:

  - name: mycontainer

    image: openshift/hello-openshift

    ports:

    - containerPort: 8080


kubectl create -f openshift-pod.yaml

pod/mypod1 created


cat openshift1-pod.yaml 

apiVersion: v1

kind: Pod

metadata:

  name: mypod2

  labels:

    mycka: round-robin

spec:

  containers:

  - name: mycontainer

    image: openshift/hello-openshift

    ports:

    - containerPort: 8080


kubectl create -f openshift1-pod.yaml

pod/mypod2 created


kubectl get pods -o wide

NAME                    READY   STATUS    RESTARTS       AGE    IP          NODE                 NOMINATED NODE   READINESS GATES

mypod1                  1/1     Running   0              33s    10.44.0.3   node-1.example.com   <none>           <none>

mypod2                  1/1     Running   0              9s     10.44.0.4   node-1.example.com   <none>           <none>


curl 10.44.0.3:8080

Hello OpenShift!


curl 10.44.0.4:8080

Hello OpenShift!


No comments:

Post a Comment