Working With Multiple Kubernetes Contexts

If you’re working with Kubernetes then there’s a pretty good chance that you’ve been working with kubectl! There’s also a pretty good chance that you end up working with more than one cluster context. So, how do you manage multiple contexts? KUBECONFIG One way that you might have encountered is obtaining a kubeconfig file that contains the details of how to connect to a cluster. kubectl allows you to pass a --kubeconfig option to commands to specify which kubeconfig should be used to connect to a cluster to execute the command. [Read More]

Working With Git Rebase in Visual Studio Code

Following the git theme for mini-posts, I thought I’d give git rebase a mention this time. When I first started working with git I found a way to pretend that it was a source control system like any other that I’d used. Eventually, I was working on a pull request for an OSS project and a maintainer asked me to rebase my changes. Now, I’d heard of rebase at that point but I hadn’t used it, so I was a bit daunted. [Read More]

Using Event Filters with Kubebuilder

Part 2: Filtering Updates

Background As I recently posted, I’ve worked on a couple of projects that have involved using Kubebuilder to create Kubernetes operators. In last post we looked at using event filters to prevent delete notifications being processed by the reconciliation loop. Another thing I’ve noticed as I’ve been developing operators is that the flow when an object is created is typically: receive create notification, take some action, update the object Status property. [Read More]

Connection re-use in Golang with http.Client

Just before Christmas I was working with Eliise and Lawrence and we observed port exhaustion during load testing of a Golang application that makes HTTP requests against an API. I hoped for a quick win and had a quick scan of the code but that confirmed that the was correctly reading the Body and calling Close - time to dig a bit deeper. After some head-scratching we noticed that the code creates a new http. [Read More]

Using Event Filters with Kubebuilder

Part 1: Filtering Deletes

UPDATE (2020/01/08 ): After testing this in another project I discovered that the NotFound checking is still required in the case where the reconciliation has been requeued and the object is deleted in the interim period. Even with this code, I still prefer not having the NotFound output in my logs for the default case. Background A couple of projects recently have involved using Kubebuilder to create Kubernetes operators. Kubebuilder scaffolds out a go application and then lets you focus on writing the logic of the reconciliation loop which is the core part of the operator. [Read More]