0
0
Kubernetesdevops~5 mins

Why operators extend Kubernetes - Why It Works

Choose your learning style9 modes available
Introduction
Kubernetes manages many applications but sometimes needs extra help to handle complex tasks automatically. Operators are special programs that add this extra help by managing applications like a human would, but faster and without mistakes.
When you want Kubernetes to manage complex application tasks automatically, like backups or upgrades.
When your application needs special steps to start or stop that Kubernetes does not do by default.
When you want to keep your application running smoothly without manual checks.
When you want to automate recovery if your application crashes or has problems.
When you want to add custom features to Kubernetes for your specific app needs.
Commands
This command lists all Custom Resource Definitions (CRDs) installed in Kubernetes, which are often created by operators to add new types of resources.
Terminal
kubectl get crd
Expected OutputExpected
myappconfigs.example.com 2024-06-01T12:00:00Z postgresclusters.database.example.com 2024-06-01T12:05:00Z
This command shows the running operator pods in the 'operators' namespace, which are the programs extending Kubernetes functionality.
Terminal
kubectl get pods -n operators
Expected OutputExpected
NAME READY STATUS RESTARTS AGE myapp-operator-5d7f9c7d9f-abcde 1/1 Running 0 10m postgres-operator-7c8d9f6f7f-fghij 1/1 Running 0 15m
This command shows details about the custom resource definition created by an operator, explaining what new resource it adds to Kubernetes.
Terminal
kubectl describe crd myappconfigs.example.com
Expected OutputExpected
Name: myappconfigs.example.com Scope: Namespaced Names: Kind: MyAppConfig ListKind: MyAppConfigList Plural: myappconfigs Singular: myappconfig Versions: - name: v1alpha1 served: true storage: true
Key Concept

Operators add new knowledge to Kubernetes so it can manage complex applications automatically like a human expert would.

Common Mistakes
Trying to manage complex app tasks manually without using operators.
Manual management is slow, error-prone, and does not scale well.
Use operators to automate complex tasks and keep apps healthy automatically.
Not checking if the operator pods are running after installation.
If operator pods are not running, the custom resources won't be managed properly.
Always verify operator pods are running with 'kubectl get pods -n operators'.
Ignoring the custom resource definitions and trying to use unsupported resource types.
Kubernetes won't recognize or manage resources not defined by CRDs.
Check CRDs installed by operators and use only those custom resource types.
Summary
Operators extend Kubernetes by adding custom resource definitions to manage complex apps.
Check installed CRDs with 'kubectl get crd' to see what new resources operators add.
Verify operator pods are running to ensure automatic management works.