Sign inSign up

nicc777/k8s-cli-tools

By nicc777

•Updated 20 days ago

Kubectl and Helm binaries in a Alpine base container

Image
Developer tools
0

465

nicc777/k8s-cli-tools repository overview

Repository at https://codeberg.org/nicc777/k8s-cli-tools⁠


⁠k8s-cli-tools

Kubectl and Helm binaries in a Alpine base container

Note

Instructions shows `podman`, but `docker` should work exactly the same.

⁠Install

Using podman (also works for for docker):

podman pull docker.io/nicc777/k8s-cli-tools

⁠Build

Run:

podman build --no-cache -t k8tools-alpine .

⁠Usage

⁠Kubectl Usage

Example:

podman run --network host -v $HOME/my_clusters.yaml:/config:ro -e KUBECONFIG="/config" -it docker.io/nicc777/k8s-cli-tools:latest /kubectl version

Example output:

Client Version: v1.36.0
Kustomize Version: v5.8.1
Server Version: v1.35.4+k3s1
⁠Helm Usage

Helm may need to set a configuration file as well as maintain some data and therefore require some additional paths.

Once-off preparation:

mkdir -p $HOME/.cache/helm $HOME/.config/helm $HOME/.local/share/helm

Example:

podman run --network host \
  -v $HOME/.cache/helm:/helm-cache:rw,Z \
  -v $HOME/.config/helm:/helm-config:rw,Z \
  -v $HOME/.local/share/helm:/helm-share:rw,Z \
  -e KUBECONFIG="/config" \
  -e HELM_CACHE_HOME="/helm-cache" \
  -e HELM_CONFIG_HOME="/helm-config" \
  -e HELM_DATA_HOME="/helm-share" \
  -it docker.io/nicc777/k8s-cli-tools:latest \
  /helm version

Example output:

version.BuildInfo{Version:"v4.1.4", GitCommit:"05fa37973dc9e42b76e1d2883494c87174b6074f", GitTreeState:"clean", GoVersion:"go1.25.9", KubeClientVersion:"v1.35"}

Note

In this example, the current working directory is mounting in the containers `WORKDIR` and therefore commands like `helm create ...` will also create new Helm projects in the local directory.

It may be convenient to create an alias:

alias helm='podman run --network host -v $HOME/.cache/helm:/helm-cache:rw,Z -v $HOME/.config/helm:/helm-config:rw,Z -v $HOME/.local/share/helm:/helm-share:rw,Z -e KUBECONFIG="/config" -e HELM_CACHE_HOME="/helm-cache" -e HELM_CONFIG_HOME="/helm-config" -e HELM_DATA_HOME="/helm-share" -it docker.io/nicc777/k8s-cli-tools:latest /helm '

Use it as follows:

helm list --all-namespaces

Tag summary

Content type

Image

Digest

sha256:446a06e81…

Size

71 MB

Last updated

20 days ago

docker pull nicc777/k8s-cli-tools