Hi, I am Akshay Rao currently working in Annotation. There are three ways to create and manage Kubernetes objects.
We will go through each way one by one.
When we want to operate directly on live objects in an cluster we can use the imperative commands, the commands are directly written on the kubectl command line as a argument or flags.
Example:- In this a pod is created using nginx image.
Imperative object configuration
As we saw in the imperative commands that to add definition to a pod has to done one by one inorder to overcome the difficulty we can use the imperative object configuration in which we can create a yml file, list all the definitions of the pod and run it. Example:- we are creating a pod name web-declarative from a web-deployment.yml file.
apiVersion: v1 kind: Pod metadata: name: web-declarative annotations: site: blog spec: containers: - name: web image: nginx:1.17.1
Declarative object configuration
When using declarative object configuration, a user manipulates locally stored object configuration files, but the user does not specify the actions to be executed on the files. By using
kubectl, create, update, and delete operations are automatically identified for each individual object. This makes it possible to work on directories, where various procedures may be required for various items.
These are the three ways to operate with kubernetes objects. I hope this helps you to understand. Thank you