Skip to content

showcase on how to create a simple kubernetes operator

Notifications You must be signed in to change notification settings

Noroth/simple-status-operator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kubebuilder tutorial

1. install the required tools

Follow the steps on the documentation

Kustomize Binary Installation guide

Install with homebrew

brew install kustomize
os=$(go env GOOS)
arch=$(go env GOARCH)

# download kubebuilder and extract it to tmp
curl -L https://go.kubebuilder.io/dl/2.3.1/${os}/${arch} | tar -xz -C /tmp/

# move to a long-term location and put it on your path
# (you'll need to set the KUBEBUILDER_ASSETS env var if you put it somewhere else)
sudo mv /tmp/kubebuilder_2.3.1_${os}_${arch} /usr/local/kubebuilder
export PATH=$PATH:/usr/local/kubebuilder/bin

2. Initialize a new project

domain=noroth.io
kubebuilder init --domain ${domain}

3. Create a new API for show cases

# create a custom resource definition for a counter
kubebuilder create api --group app --version v1beta1 --kind Counter

4. Update the /api/v1beta1/counter_types.go

Add values for spec and status

If you want your status to be displayed with kubectl you need to add specific marker comments.

See Printer Columns

5. Install CRDs

# Make sure you have a connection to a kubernetes cluster or minikube available
# Run some commands
make generate; make manifests
# install the CRDs
make install

kubectl apply -f config/samples/{resource}
## run the application
make run

6. Deployment

See Documentation

About

showcase on how to create a simple kubernetes operator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published