Skip to content

Instantly share code, notes, and snippets.

@wpcarro
Created January 6, 2023 02:33
Show Gist options
  • Save wpcarro/408bf92b19e08e99ddbda17500c8ed3f to your computer and use it in GitHub Desktop.
Save wpcarro/408bf92b19e08e99ddbda17500c8ed3f to your computer and use it in GitHub Desktop.
Dispatch command to k8s
apiVersion: batch/v1
kind: Job
metadata:
name: foo-command
spec:
ttlSecondsAfterFinished: 60
template:
spec:
containers:
- name: foo-command
image: production_command
imagePullPolicy: "Never"
command: "$COMMAND"
restartPolicy: Never
#!/usr/bin/env bash
# Install this somewhere on PATH as runcmd, and invoke like so:
# USAGE: runcmd foo --flag=true --force path/to/file
COMMAND="$@" envsubst -no-unset -no-empty <command.yaml.tmpl | kubectl apply -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment