Run a dummy job on Kubernetes

Assuming kubectl is configured:

Run as job:

# Start job
kubectl create job hello  \
  --image=busybox  \
  -- echo "Hello from a Kubernetes Job"

# See it run/complete
kubectl get jobs

# View logs from job
kubectl logs job/hello

# Clean up
kubectl delete job hello

Run as normal pod:

# Start pod
kubectl run hello \
  --image=busybox \
  --restart=Never \
  -- echo "Hello from Kubernetes"

# See it run/complete
kubectl get pods

# View logs from job
kubectl logs job/hello

# Clean up
kubectl delete pod hello

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.