A lightweight Docker image bundling both kubectl and helm CLIs for Kubernetes cluster management, CI/CD automation, and scripting.
- 🛠️ Includes:
- 🧬 Multi-architecture support for
linux/amd64andlinux/arm64 - 📦 Minimal and portable CLI environment
- 🚀 Ideal for:
- CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins, etc.)
- Infrastructure automation
- Local development without installing
kubectlorhelm
docker run --rm \
-v ~/.kube:/root/.kube:ro \
oneidels/kubectl \
kubectl get pods --all-namespacesdocker run --rm \
-v ~/.kube:/root/.kube:ro \
-v $(pwd)/charts:/charts \
oneidels/kubectl \
helm install my-release /charts/my-appHere’s a simple example of a CronJob that runs the oneidels/kubectl image to execute a Kubernetes command on a schedule:
apiVersion: batch/v1
kind: CronJob
metadata:
name: example-kubectl-cronjob
spec:
schedule: "0 3 * * *" # Runs daily at 3 AM
jobTemplate:
spec:
template:
spec:
containers:
- name: kubectl
image: oneidels/kubectl
command:
- /bin/sh
- -c
- kubectl get pods --all-namespaces
volumeMounts:
- name: kubeconfig
mountPath: /root/.kube
readOnly: true
restartPolicy: OnFailure
volumes:
- name: kubeconfig
secret:
secretName: my-kubeconfig-secretNote:
The example assumes you have a Kubernetes Secret namedmy-kubeconfig-secretcontaining your kubeconfig file. Adjust as needed for your environment.
- Mount your local
~/.kubeconfig to/root/.kubeinside the container for access to clusters. - Mount Helm charts or other resources as needed for your use case.
- Built for quick, secure use in automation.
- Tags follow common Kubernetes/Helm versioning.
Feel free to open issues or submit PRs to help improve this image. Feature requests welcome!
GitHub Actions CI builds and publishes on these events:
- Push to
main: builds immediately and tags the image asoneidels/kubectl:latest, then runs smoke tests. - Nightly cron (00:00 UTC): fetches the stable Kubernetes release, tags the image as
oneidels/kubectl:<k8s-version>andlatest, then runs smoke tests. - Manual dispatch: run the workflow interactively from the GitHub Actions tab.
The workflow is in .github/workflows/docker-publish.yml. To enable Docker Hub pushes, set these repository secrets:
DOCKERHUB_USERNAME– your Docker Hub usernameDOCKERHUB_TOKEN– Docker Hub access token or password