OpenShift Simple Pod Running inside an OpenShift Project: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Overview=
=Overview=


This is the procedure to deploy a simple pod that starts executing inside an OpenShift project and permits arbitrary process execution inside it. This could prove useful while troubleshooting network issues which need running network utilities and tests from "inside the project". The pod will initialize a container based on a generic image, available in the Docker Hub. The pod will be started as soon as it is declared. Since there is no replication controller, the pod will be terminated and it will disappear when it is deleted.
This is the procedure to deploy a simple [[OpenShift Pod Concepts#Overview|pod]] that starts executing inside an OpenShift project and permits arbitrary process execution inside it. This could prove useful while troubleshooting network issues which need running network utilities and tests from "inside the project". The pod will initialize a container based on a generic image, available in the Docker Hub. The pod will be started as soon as it is declared. Since there is no replication controller, the pod will be terminated and it will disappear when it is deleted.


=Procedure=
=Procedure=
Line 25: Line 25:
The command from the container specification is optional, if missing, the image's command will be executed.
The command from the container specification is optional, if missing, the image's command will be executed.


Alternatively, a similar pod that contains [[oc|oc]] can be created from https://github.com/NovaOrdis/playground/blob/master/openshift/templates/standalone-pod-template.yaml:


oc process -f https://raw.githubusercontent.com/NovaOrdis/playground/master/openshift/templates/standalone-pod-template.yaml | oc create -f -


Alternatively, a similar pod that contains [[oc|oc]] can be created from https://github.com/NovaOrdis/playground/blob/master/openshift/templates/standalone-pod-template.yaml:
To open a shell inside the container:


  oc process -f https://raw.githubusercontent.com/NovaOrdis/playground/master/openshift/templates/standalone-pod-template.yaml | oc create -f -
  oc rsh centos-loop


then:
To execute the probe remotely:


  oc rsh standalone-pod
  oc exec centos-loop /opt/probe


When you don't need it anymore:
When you don't need it anymore:


  oc delete standalone-pod
  oc delete centos-loop

Latest revision as of 01:20, 28 February 2018

Internal

Overview

This is the procedure to deploy a simple pod that starts executing inside an OpenShift project and permits arbitrary process execution inside it. This could prove useful while troubleshooting network issues which need running network utilities and tests from "inside the project". The pod will initialize a container based on a generic image, available in the Docker Hub. The pod will be started as soon as it is declared. Since there is no replication controller, the pod will be terminated and it will disappear when it is deleted.

Procedure

The pod can be created from the following template:

apiVersion: v1
kind: Pod
metadata:
  name: centos-loop
spec:
  containers:
  - name: centos-loop
    image: docker.io/novaordis/centos-loop:1
    resources:
      limits:
        memory: 128Mi

The command from the container specification is optional, if missing, the image's command will be executed.

Alternatively, a similar pod that contains oc can be created from https://github.com/NovaOrdis/playground/blob/master/openshift/templates/standalone-pod-template.yaml:

oc process -f https://raw.githubusercontent.com/NovaOrdis/playground/master/openshift/templates/standalone-pod-template.yaml | oc create -f -

To open a shell inside the container:

oc rsh centos-loop

To execute the probe remotely:

oc exec centos-loop /opt/probe

When you don't need it anymore:

oc delete centos-loop