Skip to content

Sleeper pod

Why

Sometimes we need to run a pod on the cluster to exec in to and test things, like web requests etc

How

apiVersion: v1
kind: Pod
metadata:
  name: sleeper
spec:
  containers:
    - name: alpine
      image: alpine:latest
      # Just spin & wait forever
      command: [ "/bin/sh", "-c", "--" ]
      args: [ "while true; do sleep 30; done;" ]
apiVersion: v1
kind: Pod
metadata:
  name: sleeper
spec:
  serviceAccountName: <>
  containers:
    - name: alpine
      image: alpine:latest
      # Just spin & wait forever
      command: [ "/bin/sh", "-c", "--" ]
      args: [ "while true; do sleep 30; done;" ]
apiVersion: v1
kind: Pod
metadata:
  name: sleeper
spec:
  containers:
    - name: alpine
      image: alpine:latest
      # Just spin & wait forever
      command: [ "/bin/sh", "-c", "--" ]
      args: [ "while true; do sleep 30; done;" ]
      envFrom:
        - configMapRef:
            name: <config map name>

Exec in to the pod

admin exec -it pod/sleeper /bin/sh

Want to make this site better? Open a PR or help fund hosting costs