where the code is located
https://github.com/mafa1993/kubernetes-learn/tree/main/operator/client-go
Where k8s can be expanded
-
kubectl
-
api server , block requests, edit requests, delete requests, etc.
-
Use label and annotate to modify k8s resources
-
crd, custom resource
-
scheduler
-
kubelet,CSI CNI CRI
-
controller manager collection of controllers
-
custom controller
-
client go
k8s controler
-
It is generally recommended that a controller track at least one k8s resource
-
Bring the status to the state defined by the spec
-
Different controllers can cooperate with each other to realize complex tasks
-
Use client go to interact with api server
client go
-
Source address https://github.com/kubernetes/client-go
-
Explanation of client-go directory
-
kubernetes saves all clients accessed by k8s api
-
informer
-
listers Read the resource information of k8s in the cache
-
Discovery is used to discover the api supported by the api server
-
dynamic is used to manipulate resource objects
-
auth authentication
-
tools
-
transport creates connections, etc.
-
-
k8s controller architecture diagram
controller logic
-
Observe, obtain the loading of the current object by monitoring the changes of kubernetes resources, inject the observer into the eventHandler, and put the transformed object into the workQueue
-
Analysis, comparing the current state and the expected state, completed by the worker
-
Execute, execute the current state into the desired state, and the worker completes
-
Update, update the current status of the object, completed by the worker