Back in May 2026, Red Hat released Red Hat Hardened Images, which are distroless images for various languages and runtimes. The repository used to build these images is https://gitlab.com/redhat/hummingbird/containers and I think these are great base images if you are looking for a more minimal or hardened setup.
Given the nature of these distroless images, there is obviously no shell included in the container image, which makes debugging harder. This means when trying to debug such an image using oc rsh or similar, this will fail with an error message:
$ oc create deployment apache --image=registry.access.redhat.com/hi/httpd:latest
$ oc get po
NAME READY STATUS RESTARTS AGE
apache-6bc857d844-qmxcr 1/1 Running 0 65s
$ oc rsh apache-6bc857d844-qmxcr
2026-07-08T19:27:02.257947Z: executable file `/bin/sh` not found: No such file or directory
command terminated with exit code 1
Read the rest of this entry
So when working with a lot of different namespaces in Kubernetes and you only know the “oc project” command from OpenShift, you start to miss an easy way to change namespaces in Kubernetes.
The official documentation to switch namespaces proposes something like this:
$ kubectl config set-context $(kubectl config current-context) --namespace=<insert-namespace-name-here>
Not something that I want to type regularly. First I tried to create a BASH alias or something, which did not work. So I looked around for BASH functions. I found that Jon Whitcraft proposed a nice BASH function in a GitHub issue. I lightly modified this and placed this in my own .bashrc file:
function kubectlns() {
ctx=`kubectl config current-context`
ns=$1
# verify that the namespace exists
ns=`kubectl get namespace $1 --no-headers --output=go-template={{.metadata.name}} 2>/dev/null`
if [ -z "${ns}" ]; then
echo "Namespace (${1}) not found, using default"
ns="default"
fi
kubectl config set-context ${ctx} --namespace="${ns}"
}
So to change your namespace, use something like this:
$ kubectlns simon
Context "kubernetes-admin@kubernetes" modified.
Nice and short.