Last active
May 27, 2022 05:02
-
-
Save moinuddin14/bcf070517cc2bee45e1721558258a5fc to your computer and use it in GitHub Desktop.
This gist consists of examples for Kubernetes Labels, Selectors and Annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Labels with prefix | |
apiVerion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app.kubernetes.io/name: redpod | |
app.kubernetes.io/version: 1.24 | |
# Labels without prefix | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: nginx | |
labels: | |
environment: prod | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:1.14.2 | |
ports: | |
- containerPort: 80 | |
# Kubernetes Service Kind with Selectors | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: my-nginx | |
labels: | |
app: nginx | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
selector: | |
environment: prod | |
app: nginx | |
# Annotation Example | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: annotations-demo | |
annotations: | |
imageregistry: "https://hub.docker.com/" | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:1.14.2 | |
ports: | |
- containerPort: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment