/k8s-operator

Showing how to create kubernetes operators in Go

Primary LanguageSmartyMIT LicenseMIT

k8s-operator

Showing how to create kubernetes operators in Go

Prerequisites:

Create a local cluster with kind:

kind create cluster --name testingk8soperator --config ./kind/kind-config.yaml

Testing getting nodes:

kubectl get nodes

Should show somethinkg like this:

NAME                           STATUS   ROLES           AGE   VERSION
k8soperatork8s-control-plane   Ready    control-plane   43s   v1.27.3
k8soperatork8s-worker          Ready    <none>          22s   v1.27.3
k8soperatork8s-worker2         Ready    <none>          22s   v1.27.3

Creating a golang project

go mod init a-cool-domain.io/k8s

create a main.go file

package main

func main() {
	println("Hello, World!")
}