Skip to content

Instantly share code, notes, and snippets.

@katarzyna-dusza
Last active May 31, 2020 15:26
Show Gist options
  • Save katarzyna-dusza/980a328acd997f3302c6e170fb1b63e2 to your computer and use it in GitHub Desktop.
Save katarzyna-dusza/980a328acd997f3302c6e170fb1b63e2 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-deployment-name # DEPLOYMENT_NAME
labels:
# we pass selector, to easy list specific Deployments:
# kubectl get deployment --selector=KEY_DEPLOYMENT_SELECTOR
application: backend # KEY_DEPLOYMENT_SELECTOR: VALUE_DEPLOYMENT_SELECTOR
resource: deployment
spec:
replicas: 3 # NUMBER_OF_REPLICAS (number of Pods)
selector:
matchLabels:
# thanks to this selector, we specify, which Pods belong to this Deployment
application: backend # KEY_POD_SELECTOR: VALUE_POD_SELECTOR
template: # here the Pod specification starts (look at the example-pod.yaml)
metadata:
labels:
# all Pods will get this label
# so Deployment will easily find all his Pods
application: backend # KEY_POD_SELECTOR: VALUE_POD_SELECTOR
spec:
containers:
- name: main-container # CONTAINER_NAME
image: my-backend # IMAGE_NAME
tag: v1 # TAG
ports:
- containerPort: 8080 # CONTAINER_PORT_NUMBER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment