Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
OperatorHub for Community Operators
📖 Scenario: You are part of a Kubernetes community team. Your goal is to prepare a simple Operator manifest and configure it for publishing on OperatorHub, a platform where Kubernetes operators are shared and discovered by users.This project will guide you through creating a basic Operator manifest, adding metadata configuration, applying core OperatorHub labels, and finally displaying the manifest ready for submission.
🎯 Goal: Build a Kubernetes Operator manifest YAML file with the required metadata and labels for OperatorHub community operators.You will create the manifest step-by-step, add configuration labels, and output the final YAML manifest.
📋 What You'll Learn
Create a basic Operator manifest dictionary with apiVersion, kind, and metadata
Add a label for the OperatorHub community operator category
Add core OperatorHub labels like 'operators.operatorframework.io.bundle.channels.v1'
Print the final YAML manifest as output
💡 Why This Matters
🌍 Real World
Community operators are shared on OperatorHub to help Kubernetes users find and install useful software easily.
💼 Career
Knowing how to prepare and configure Operator manifests is important for DevOps roles working with Kubernetes and cloud-native applications.
Progress0 / 4 steps
1
Create the basic Operator manifest dictionary
Create a dictionary called operator_manifest with these exact entries: apiVersion: "operators.coreos.com/v1alpha1", kind: "ClusterServiceVersion", and metadata as a nested dictionary with name: "community-operator" and namespace: "operators".
Kubernetes
Hint
Use a Python dictionary with keys apiVersion, kind, and metadata. The metadata itself is a dictionary with name and namespace.
2
Add OperatorHub community operator label
Add a labels dictionary inside operator_manifest["metadata"] with the exact entry "operators.operatorframework.io/community-operator": "true".
Kubernetes
Hint
Inside the metadata dictionary, add a labels dictionary with the required key and value.
3
Add core OperatorHub labels for channels
Inside operator_manifest["metadata"]["labels"], add the exact entry "operators.operatorframework.io.bundle.channels.v1": "stable".
Kubernetes
Hint
Add the new label inside the existing labels dictionary without removing the previous label.
4
Print the final Operator manifest as YAML
Import the yaml module and use print(yaml.dump(operator_manifest)) to display the final Operator manifest in YAML format.
Kubernetes
Hint
Use import yaml at the top and then print(yaml.dump(operator_manifest)) to show the manifest.
Practice
(1/5)
1. What is OperatorHub in Kubernetes?
easy
A. A tool to monitor Kubernetes cluster health
B. A marketplace for community-made Kubernetes operators
C. A command to deploy pods automatically
D. A storage solution for Kubernetes volumes
Solution
Step 1: Understand the purpose of OperatorHub
OperatorHub is designed as a marketplace where community developers share Kubernetes operators.
Step 2: Compare options with the definition
Only A marketplace for community-made Kubernetes operators correctly describes OperatorHub as a marketplace for community-made operators.
Final Answer:
A marketplace for community-made Kubernetes operators -> Option B
Quick Check:
OperatorHub = Marketplace for operators [OK]
Hint: Remember: OperatorHub = community operator marketplace [OK]
Common Mistakes:
Confusing OperatorHub with monitoring tools
Thinking OperatorHub manages storage
Assuming OperatorHub deploys pods directly
2. Which command lists available operators from OperatorHub?
easy
A. kubectl show operatorhub
B. kubectl list operators
C. kubectl get packagemanifests
D. kubectl get operators
Solution
Step 1: Recall the command to view OperatorHub operators
The correct command is 'kubectl get packagemanifests' to list available operators.
Step 2: Eliminate incorrect commands
Other options are not valid kubectl commands for this purpose.
Final Answer:
kubectl get packagemanifests -> Option C
Quick Check:
List operators = kubectl get packagemanifests [OK]
Hint: Use 'kubectl get packagemanifests' to list operators [OK]
Common Mistakes:
Using 'kubectl get operators' which is invalid
Trying 'kubectl list operators' which does not exist
Confusing with 'kubectl show operatorhub'
3. What happens when you create a Subscription resource pointing to an OperatorHub operator?
medium
A. The cluster restarts immediately
B. The operator is listed but not installed
C. The operator is removed from the cluster
D. The operator is installed and updates are managed automatically
Solution
Step 1: Understand Subscription resource role
Creating a Subscription tells Kubernetes to install the operator and manage updates.
Step 2: Analyze each option
Only The operator is installed and updates are managed automatically correctly describes installation and update management. Others describe unrelated or incorrect effects.
Final Answer:
The operator is installed and updates are managed automatically -> Option D
Hint: Subscription resource installs and updates operators [OK]
Common Mistakes:
Thinking Subscription only lists operators
Assuming Subscription removes operators
Believing Subscription causes cluster restart
4. You tried to install an operator by creating a Subscription but it did not install. What is a likely cause?
medium
A. The Subscription resource is missing the correct channel or package name
B. The Kubernetes cluster is offline
C. OperatorHub is not installed on the cluster
D. You used 'kubectl get packagemanifests' instead of 'kubectl apply'
Solution
Step 1: Check Subscription resource correctness
If the Subscription lacks the right channel or package name, the operator won't install.
Step 2: Evaluate other options
Cluster offline would prevent all commands; OperatorHub is a service, not installed; wrong command usage is unrelated to Subscription creation.
Final Answer:
The Subscription resource is missing the correct channel or package name -> Option A
Quick Check:
Subscription details must be correct to install operator [OK]
Hint: Check Subscription fields: channel and package name [OK]
Common Mistakes:
Assuming OperatorHub must be installed separately
Confusing command usage with resource correctness
Ignoring Subscription spec details
5. You want to install a community operator from OperatorHub that requires a specific namespace and approval strategy. How do you ensure this during installation?
hard
A. Create a Subscription with 'installPlanApproval' set to 'Manual' and specify the target namespace
B. Run 'kubectl install operator --namespace target' directly
C. Modify the OperatorHub source code to add namespace and approval
D. Use 'kubectl get packagemanifests' with flags for namespace and approval
Solution
Step 1: Understand Subscription customization
Subscription resource supports 'installPlanApproval' to control approval and allows specifying target namespace.
Step 2: Evaluate other options
Direct kubectl install command does not exist; modifying OperatorHub source is unnecessary; 'kubectl get packagemanifests' only lists operators.
Final Answer:
Create a Subscription with 'installPlanApproval' set to 'Manual' and specify the target namespace -> Option A
Quick Check:
Subscription controls approval and namespace settings [OK]
Hint: Set 'installPlanApproval' and namespace in Subscription YAML [OK]
Common Mistakes:
Trying to install operators with non-existent kubectl commands