CRDs are only a mean to specify a configuration, though. The cluster still needs controllers to monitor its state and reconcile the resource to match with the configuration (make consistent with another).Operators are controllers working in association with custom resources to perform tasks that generally… “human operators” have to take care of. Operators are the CRDs associated with controllers which observe and act upon changes in the configuration or changes in the state of the cluster The etcd operator manages etcd clusters deployed to Kubernetes and automates tasks related to operating an etcd cluster.
log on to katacoda k8s course site
- curl -LO https://dl.google.com/go/go1.12.3.linux-amd64.tar.gz
- tar -C /usr/local -xzf go1.12.3.linux-amd64.tar.gz
- export PATH=$PATH:/usr/local/go/bin
- mkdir /root/go
- export GOPATH=/root/go
- export GOBIN=/usr/local/go/bin
- export PATH=$PATH:$(go env GOPATH)/bin
- go env GOPATH
- read How to write GO code
- mkdir -p $GOPATH/src/github.com/operator-framework
- cd $GOPATH/src/github.com/operator-framework
- git clone https://github.com/operator-framework/operator-sdk
- cd operator-sdk
- git checkout master
- make dep
- make install
- git config --global user.email robert.rong@agile-solutions.ch
- git config --global user.name agilesolutions
- mkdir -p $GOPATH/src/github.com/agilesolutions/
- cd $GOPATH/src/github.com/agilesolutions/
- operator-sdk new podset-operator
- tree -I vendor
- cd podset-operator
- operator-sdk add api --api-version=app.example.com/v1alpha1 --kind=PodSet
- operator-sdk add controller --api-version=app.example.com/v1alpha1 --kind=PodSet
- operator-sdk build agilesolutions/podset-operator
- docker login -u agilesolutions
- docker push agilesolutions/podset-operator
- log on to https://www.katacoda.com/courses/kubernetes/launch-single-node-cluster
- start scenario
- minikube start
- mkdir -p $GOPATH/src/github.com/agilesolutions
- cd $GOPATH/src/github.com/agilesolutions
- git clone https://github.com/agilesolutions/podset-operator.git
- cd podset-operator
- go install & build
- kubectl create -f deploy/service_account.yaml
- kubectl create -f deploy/role.yaml
- kubectl create -f deploy/role_binding.yaml
- kubectl create -f deploy/crds/app_v1alpha1_podset_crd.yaml
- kubectl create -f deploy/operator.yaml
- kubectl get crd podsets.app.example.com
- kubectl get pods
- kubectl get podsets.app.example.com
- kubectl apply -f examples/replicas4.yaml
- kubectl get pods -l app=example-podset
- kubectl delete pods -l app=example-podset
- kubectl get pods -l app=example-podset
- kubectl apply -f examples/replicas2.yaml
- kubectl get pods -l app=example-podset
- kubectl describe podset/example-podset
- kubectl delete podset example-podset
- kubectl get pods -l app=example-podset
- kubectl cluster-info
- kubectl get nodes
- kubectl config set-context $(kubectl config current-context) --namespace=default
- kubectl config view | grep namespace:
- kubectl get nodes
- kubectl get deployment componenta -o=custom-columns=:.metadata.annotations.contact --no-headers- kubectl get pods -l app=sa-log --show-labels
- kubectl get pods --all-namespaces
- kubectl get pods -n default
- kubectl get namespaces
- kubectl get svc -n istio-system -l istio=ingressgateway
- kubectl get svc -n istio-system -l istio=ingressgateway -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}')
- kubectl get pods -o wide
- kubectl get -f pod.yaml -o json
- kubectl get rc,services
- kubectl run first-deployment --image=katacoda/docker-http-server --port=80 --replicas=1
- kubectl expose deployment first-deployment --port=80 --type=NodePort
- export PORT=$(kubectl get svc first-deployment -o go-template='{{range.spec.ports}}{{if .nodePort}}{{.nodePort}}{{"\n"}}{{end}}{{end}}')
- kubectl apply -f /opt/kubernetes-dashboard.yaml
- kubectl get deployments
- kubectl describe deployment http
- kubectl run httpexposed --image=katacoda/docker-http-server:latest --replicas=1 --port=80 --hostport=8001
- kubectl scale --replicas=3 deployment http
- kubectl create -f deployment.yaml
- kubectl get deployment
- Get a Shell to a Running Container
- Istio traffic management