Kubernetes, aka, captain or pilot in Greek, is a open-source software for managing, scaling and orchestrating containerised applications throughout it’s lifecycle irrespective of the platform, the applications are running on, hybrid or cloud or on-premises.
Why discuss about Kubernetes?
- Allows you to manage your containers hosting different applications seamlessly.
- Automatic fail-safe system, where it starts the pods, if one of them are terminated due to system failures.
- Continuously observes the pods which represents the state of the applications running inside it and makes sure it is similar to that defined in the configuration.
- Helps to manage secrets related to our applications using various encryption keys, certificates and so on and can be attached or detached to the pods or other entities in the kubernetes ecosystem.
- Manage and divide CPU or memory usage among the nodes or pods according to your use case.
- Makes it easy to mount many types of volumes on the pods.
When to use Go for Kubernetes native applications?
- Go is a cloud-native first language, and is useful for cases where the requirement includes cases like streaming tasks, as concurrency comes in-built with Go, and also used heavily in creating CLI tools, such as kubectl itself.
- Go is by far, no doubt, the most sought language for building microservices which scale well.
- With Go, it is easier to interact with Kubernetes, as Kubernetes was written in Go, and therefore has a better support in terms of compatibility.
- Error handling in Go is quite great.
- Go comes with exceptionally shorter build times compared to other languages. To know more, read here: https://stackoverflow.com/questions/2976630/how-does-go-compile-so-quickly
When to use Rust for Kubernetes native applications?
- Rust is a memory-safe language.
- If you want to have a control over the memory management and how to use the machine’s resources more efficiently, go ahead with Rust.
- The borrow checker in Rust can prevent cases of illegal data access or even data races when you are trying to access or manage pods or other k8s resources programmatically.
- With the help of Rust, many race conditions can be avoided which might have been not caught while using Go.
You can read more about it here: https://www.heavybit.com/library/podcasts/the-kubelist-podcast/ep-21-krustlet-with-taylor-thomas-and-matt-butcher/
From what I have understood till now after using both Rust and Go is that they are frequently used languages and they are certainly not bitter rivals. It’s just that, the use-cases are different. Rust is used where memory safety takes precedence whereas Go’s popularity can be well-attributed to it’s shorter build times and go-routines. The decision that ones needs to take in terms of what language to choose for development depends on it’s requirements specific to the application.
I know, Go might be easier to learn and develop on top of it, but being said that it is also true that Rust, though complex, has multiple ways of dealing with a problem in a memory-safe way.