OpenShift Simple Pod Running inside an OpenShift Project

From NovaOrdis Knowledge Base
Revision as of 04:14, 18 January 2018 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

This is the procedure to deploy a simple pod that starts executing inside an OpenShift project and permits attaching. This could prove useful while troubleshooting network issues which need running network utilities and tests from "inside the project". 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

Use the following template: 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 it can be created from the following content:

apiVersion: v1
kind: Pod
metadata:
  name: standalone-pod
spec:
  containers:
  - name: oc
    image: docker.io/openshiftdemos/oc
    command: ["/bin/bash", "-c", "sleep 1000000"]
    resources:
      limits:
        memory: 128Mi

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

then:

oc rsh standalone-pod

When you don't need it anymore:

oc delete standalone-pod