Home > database >  What is kind:test in kubernetes
What is kind:test in kubernetes

Time:10-11

One of my project which is using kubernetes to manage the containers has something called test. Where developer has defined connectivity.

I tried to search it over the internet but found nothing which can clear this.

Can somebody help me to understand this kind and connectivity in test.yml?

kind: test
spec:
   connectivity:
      to:
      from

CodePudding user response:

It's what we call creating CustomResourceDefinition (CRD) in kubernetes world.

Read the docs : Using Custom Resources for clarity.

CodePudding user response:

kind: Test is a CustomResource (CR). CRs can be used in a cluster after applying a CustomResourceDefinition (CRD) that describes all the fields.

By doing so you extend Kubernetes with new objects that can be used. This is useful if you want to write your own operator or controller. Without an operator/controller the CR is not doing anything. It will just hold some information that you can lookup (similar to a ConfigMap) but it will not do anything.

Here is an explanation on how Kubernetes works for in-built objects such as a Deployment:

  1. You use kubectl apply -f some-deployment.yaml
  2. Your call will be sent to the kube-apiserver
  3. The kube-apiserver will save the information (name of the Deployment, replicas, image to use, ...) in etcd
  4. The kube-controller-manager continuously communicates to the kube-apiserver and asks him to show him all information there is regarding Deployments.
  5. The kube-apiserver retrieves the information from etcd and sends it back to the kube-controller-manager
  6. The kube-controller-manager sees that there is a new Deployment (the one you applied) and will now proceed on creating the Pods (and before that the ReplicaSet).

As you can see the one that actually creates the Pods is the kube-controller-manager.

In case the kube-controller-manager does not support all the features you expect from Kubernetes, you are able to create your own controller which is called an operator by using the operator SDK. Your operator can then watch all objects that you will create as a CustomResource (such as Test).

To check all the CRDs you applied on your cluster execute:

$ kubectl get crd

To get a list of all objects that you can apply to Kubernetes execute the following:

$ kubectl api-resources
  • Related