Category: Kubernetes

  • Kubernetes – Prevent Empty Replicasets From Deployments

    Kubernetes – Prevent Empty Replicasets From Deployments

    Kubernetes deployments are funny. For every kubectl rollout restart deployment (or it’s API equivalent), there is a new -empty- statefulset… If you want to take a look, run the following: Quite allot huh? Clean them up with: To prevent a new empty replicaset for every new deployment, add: To your deployment, this will prevent each…

  • Kubernetes – Delete All Completed Jobs One-Liner

    Kubernetes – Delete All Completed Jobs One-Liner

    Sometimes you forget, or don’t want to add, successfulJobsHistoryLimit or event perhaps failedJobsHistoryLimit. Whatever the case, the end result looks something like this: You can of course go and kubectl delete all of them, but a much quicker solution is using this one-liner: Running the above one-line will list all the jobs in the default…

  • Kubernetes – Connect To Private Container Registry

    Kubernetes – Connect To Private Container Registry

    Now that you are hosting your own registry (… are you?). You probably want to deploy Kubernetes pods from that registry. For this you need two things: Docker registry credentials saved in a Secret imagePullSecrets in deployment pointing to said Secret First, Create secret: Second, Use secret in in deployment. Example: And you’re done 🍔

  • Kubernetes – Quick Pod Shell Access With Kubeshell

    Kubernetes – Quick Pod Shell Access With Kubeshell

    Entering the bash/sh shell in an Kubernetes container can look like this: Or.. You can keep it simple with Kubeshell Press enter and you’re [hacker voice] in. GITHub.com/roubles is the author of kubeshell Easily install with pip: Hack away! 👾

  • Kubernetes – Kubectl MySQL Client One-Liner

    Kubernetes – Kubectl MySQL Client One-Liner

    Some of my applications, if not all of them, use MySQL in some fashion. The database pod is not exposed outside it’s kube-network service and is only reachable from within it’s namespace… Troubleshooting or random database querying can be a hassle. Here’s a one-liner to help you: The container will disappear when you exit the…