Kubernetes CRD example
An example of a custom Kubernetes controller that with HTTP router endpoint /health
, by default GET
method supports. But the HTTP method could be changed via Custom Resource Definition to enable/disable other HTTP method on endpoint /health
.
Ensure you got Go 1.11 installed with go mod
support.
brew install go
export GO111MODULE=on
go mod vendor
Docker is required. You may download and install the installation package, or install it via Homebrew Cask.
brew cask install docker
kubernetes is required. You may setup a K8s cluster by docker-for-desktop or minikube
kubectl is required. You could install kubectl, or install it via Homebrew.
brew install kubernetes-cli
Helm is required. You may download and install the binary releases, or install it via Homebrew.
brew install kubernetes-helm
Tiller is required. You can install it via command.
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
Draft is required. You may download and install the binary releases, or install it via Homebrew.
brew tap azure/draft && brew install draft
draft init
draft up
helm list
kubectl get all
kubectl apply -f patch/deploy.yaml
curl -XGET -i 'localhost:8888/health'
curl -XPUT -i 'localhost:8888/health'
kubectl replace -f patch/put-on.yaml
curl -XGET -i 'localhost:8888/health'
curl -XPUT -i 'localhost:8888/health'
kubectl replace -f patch/put-off.yaml
curl -XGET -i 'localhost:8888/health'
curl -XPUT -i 'localhost:8888/health'
patch/xxx-on.yaml
or patch/xxx-off.yaml
draft delete