"How to start programming in Go and for Kubernetes?" - the question I often get from fellow DevOps people. This is a tricky one. And I don't have a universal answer to it. However, I do have some thoughts to share.
But first, let me tell you my own story.
In my case, it was rather an evolutionary step - I'd been developing software for almost 10 years by the time I started coding for Kubernetes. I'd also been (sporadically) using Go for some of my server-side projects since probably 2015. And around 2019, I started my transition to, first, SRE and, then, Platform Engineering. So, when I decided to get my hands dirty with Kubernetes controllers, it was just a matter of joining the right team and picking up the Kubernetes domain. Luckily, I had a good candidate on my radar, and that required just an internal transition from one team to another.
However, based on my observations, for many contemporary DevOps engineers, the direction of the desired transformation is often inverse. From Ops to Dev (preferably, for Ops).
Since your background and experience may vary, instead of giving a concrete piece of advice here, I'll try to explain how I'd approach the problem given different levels of proficiency with the technologies.
In my opinion, "starting programming", "starting programming in Go", and "starting programming Kubernetes controllers in Go" are there different challenges with the exponentially increasing level of complexity.
Thus, for someone with little to no prior programming experience, it's impractical to try starting coding for Kubernetes right away. Well, again, IMO, of course, but I've seen enough examples when (very capable) people were losing motivation quickly due to the overly steep learning curve of such exercise. We usually can learn one (complex) thing at a time, and having difficulties with three domains simultaneously reduces the chances for success drastically.
But even if we become slightly more realistic and (temporary) remove Kubernetes from the equation, Go might not be the best choice for the first programing language. It's definitely not the worst one - I started my journey with C/C++ 😢 But there might be much simpler options like Python. Since high-level programming skills are universal, one can learn how to do loops and
ifs, how to decompose functions, and how to structure and test code without worrying about things like passing variables by pointers or by values.
At the same time, if you're already an experienced programmer but just lack the Go skills, things are simpler for you - just spend a week or two toying with the language or do a little project in it. But avoid Kubernetes libraries! It's a whole new world, and not all of them use idiomatic Go!
And only when you're (more or less) fluent in Go it's a good time to start pickup up Kubernetes-related projects.
Phew, I said it! 😌
It's a long journey, and there are no shortcuts (but there might be plenty of detour). Take your time and enjoy it! Teach yourself programming in ten years.
Speaking about learning something in general, I've never been a fan of courses or books. For me, learning must be practical - I choose (or invent) a project and try to figure out how it can be done. That's how I acquire the initial skills. And then I just go over the knowledge gaps I think I have after hacking on that project and read up on them. Or start another project if a particular knowledge gap is too big. It's fractals all the way down. But remember the "learning too many new things at a time" problem - usually, you should be choosing a project to either learn a new language (hence, you already should know how to do the business logic part) or to learn the new domain (hence, the project should be in a language that you've already mastered).
Join 4000+ happy subscribers receiving my Cloud Native round-up and get deep technical write-ups from this blog direct into your inbox.