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

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 9: Line 9:
=Procedure=
=Procedure=


Use the following template: https://github.com/NovaOrdis/playground/blob/master/openshift/templates/standalone-pod-template.yaml
The pod can be created from the following template:
 
oc process -f https://raw.githubusercontent.com/NovaOrdis/playground/master/openshift/templates/standalone-pod-template.yaml | oc create -f -
 
Alternatively it can be created from the following content:


  apiVersion: v1
  apiVersion: v1
  kind: Pod
  kind: Pod
  metadata:
  metadata:
   name: standalone-pod
   name: centos-loop
  spec:
  spec:
   containers:
   containers:
   - name: oc
   - name: centos-loop
     image: docker.io/openshiftdemos/oc
     image: docker.io/novaordis/centos-loop:1
    command: ["/bin/bash", "-c", "sleep 1000000"]
     resources:
     resources:
       limits:
       limits:
Line 29: Line 24:


The command is optional, if missing, the image's command will be executed.
The command 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 -


then:
then:

Revision as of 17:44, 18 January 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 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 -

then:

oc rsh standalone-pod

When you don't need it anymore:

oc delete standalone-pod