Skip to content

trstringer/kubectl-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

kubectl image

Usage

docker run ghcr.io/trstringer/kubectl:v1.28.3

Run kubectl in a pod

Service account

apiVersion: v1
kind: ServiceAccount
metadata:
  name: kubectl

Role

Adjust according to your requirements.

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: kubectl
rules:
  - apiGroups: [""]
    resources:
      - pods
    verbs:
      - get
      - list
      - delete

Role binding

apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: kubectl
subjects:
  - kind: ServiceAccount
    name: kubectl
roleRef:
  kind: Role
  name: kubectl
  apiGroup: rbac.authorization.k8s.io

Job

apiVersion: batch/v1
kind: Job
metadata:
  name: kubectl
spec:
  template:
    metadata:
      name: kubectl
    spec:
      restartPolicy: Never
      serviceAccountName: kubectl
      containers:
        - name: kubectl
          image: ghcr.io/trstringer/kubectl:latest
          args: ["get", "po"]
          # command: ["/bin/bash"]
          # args: ["-c", "sleep 10 && kubectl get po"]
kubectl logs -l batch.kubernetes.io/job-name=kubectl

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages