Overview
Kubernetes uses two types of metadata:Labels
Identifying metadata used for selection and organization
Annotations
Non-identifying metadata for tools and libraries
Labels
Labels are key-value pairs attached to objects for identification and selection:- Resource selection via label selectors
- Service discovery and routing
- Organizing resources by application, environment, or team
- Scheduling and placement decisions
Annotations
Annotations store arbitrary non-identifying metadata:- Build/release information
- Tool configuration (monitoring, logging, service mesh)
- Documentation and contact information
- Deployment history and rollout tracking
Viewing Labels and Annotations
In List Views
Resource list views display common labels:- Navigate to any resource type (Pods, Deployments, Services, etc.)
- Labels are shown in the list view columns
- Click on a label to filter resources with that label
In Detail Views
View all labels and annotations for a resource:In YAML View
See the raw metadata:- Open resource detail view
- Click the YAML tab
- Find the
metadatasection:
Adding Labels
Add labels through the Dashboard UI:During Resource Creation
When creating applications via the form:Dashboard automatically adds the
k8s-app label to deployments created via the form. This label is used for service discovery and dashboard organization.Editing Existing Resources
Add labels to existing resources:Adding Annotations
Add annotations for documentation and tool integration:Via YAML Editor
Common Annotations
Kubernetes System Annotations
Kubernetes System Annotations
Prometheus Annotations
Prometheus Annotations
Service Mesh Annotations
Service Mesh Annotations
Label Selectors
Use label selectors to filter and organize resources:Equality-Based Selectors
Match labels exactly:Set-Based Selectors
More flexible matching:In: Label value is in the setNotIn: Label value is not in the setExists: Label key existsDoesNotExist: Label key doesn’t exist
Using Selectors in Dashboard
Filter resources by labels:- Navigate to any resource list view
- Click a label value in the list
- Dashboard filters to show only resources with that label
Label Best Practices
Use meaningful, hierarchical labels
Use meaningful, hierarchical labels
Structure labels for clarity:
Follow Kubernetes recommended labels
Follow Kubernetes recommended labels
Use recommended label keys:
app.kubernetes.io/name: Application nameapp.kubernetes.io/instance: Unique instance identifierapp.kubernetes.io/version: Application versionapp.kubernetes.io/component: Component within architectureapp.kubernetes.io/part-of: Higher-level applicationapp.kubernetes.io/managed-by: Tool managing the resource
Keep labels short and descriptive
Keep labels short and descriptive
Good:Avoid:
Use consistent labeling schemes
Use consistent labeling schemes
Standardize across your organization:
Don't store large data in annotations
Don't store large data in annotations
Annotations are limited to 256KB total. For large data, use ConfigMaps or external storage.
Common Label Patterns
Application Identification
Environment Segregation
Team Ownership
Release Tracking
Cost Allocation
Service Discovery with Labels
Services use label selectors to find pods:Dashboard displays the label selector in the service detail view, showing which pods are selected by the service.
Deployment Selectors
Deployments use selectors to manage pods:Label Validation
Labels must follow specific rules:Label Keys
- Optional prefix + name separated by
/ - Prefix: DNS subdomain (max 253 characters)
- Name: max 63 characters
- Characters: alphanumeric,
-,_,. - Must start and end with alphanumeric
Label Values
- Max 63 characters
- Can be empty
- Characters: alphanumeric,
-,_,. - Must start and end with alphanumeric (if non-empty)
Troubleshooting
Labels not showing in list view
Labels not showing in list view
Dashboard shows a limited set of common labels in list views. View the full list in the detail view or YAML tab.
Cannot change deployment selector
Cannot change deployment selector
Deployment selectors are immutable. You must delete and recreate the deployment with a new selector.
Service not finding pods
Service not finding pods
Verify the service selector matches pod labels:
Invalid label format
Invalid label format
Ensure labels follow naming conventions:
- Max 63 characters for name
- Alphanumeric,
-,_,.only - Start and end with alphanumeric
Next Steps
Managing Resources
Learn about resource management
Managing Applications
Deploy and manage applications