0

The Plot

We're setting up a Kubernetes enviornment using RedHat's OCP.

The application that we've been given from our provider in the form of Helm charts and container images, provides a pod that basically just runs bash. From what I understand, their suggestion is that we do oc rsh <pod> do_something.sh for each of the somethings we want to do.

The Problem

I know enough about containers to be dangerous; I've never run them at anything even approaching scale. Like, I've started a couple hundred salt minions on my laptop using docker compose.

The approach of having a bash container just to rsh into and run commands in seems... silly.

The Question

Is there any non-trivial performance penalty, or any risk or downside at all, to running these commands as a Job in kubernetes instead? Something like

apiVersion: batch/v1 kind: Job metadata: name: something_doer spec: template: spec: containers: - name: something_doer image: that_bash_image:42 command: ["do_something.sh"] restartPolicy: Never backoffLimit: 5 

Is there any reason why we would not want to launch this via kubectl apply (or oc apply)?

1 Answer 1

2

I'd always, and I mean always suggest you use a bog standard Kubernetes resource over a specialized cli command of your k8s distribution.

  1. It is well known and understood.
  2. It is independent of the underlying implementation of the k8s cluster.
  3. In this case, a job creates more meaningful metrics. There is a difference between a failed job and a standard pod in a crash loop.
  4. It can be integrated into GitOps and the ecosystem (think helm, kustomize etc) much more easily.

As for performance penalties: There should only be a negligible time offset between transferring the kubernetes job and its execution and running a pod directly. Other than that, they use the same image and the same software, hence presumably the same memory and compute resources.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.