Created
August 9, 2022 07:04
-
-
Save percybolmer/c841cbbfb71d2a251b585b6e41d5ece7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
apiVersion: apps/v1 #Which version of the Kubernetes API you're using to create this object | |
kind: Deployment # What kind of object you want to create [deployment, service etc] | |
metadata: # Data that helps uniquely identify the object, including a name string, UID, and optional namespace | |
name: hellogopher | |
namespace: hellogopher | |
spec: # What state you desire for the object | |
selector: # Define what selectors the Deployment uses to find the PODS that are related to it | |
matchLabels: # matchLabels is a map of {key,value} pairs. | |
app: hellogopher | |
replicas: 1 # Tells the deployment to run 1 pod | |
template: # When creating new pods, this template will be used | |
metadata: | |
labels: # Labels used when searching / managing deployments | |
app: hellogopher | |
spec: | |
containers: | |
- name: hellogopher # Name of the Container | |
image: programmingpercy/hellogopher:5.0 # Important, to not use latest tag as it will try DOckerhub then | |
imagePullPolicy: IfNotPresent # Will only pull from DockerHub if not present already in Local docker | |
env: | |
# Use secret in real usage | |
- name: DATABASE_USERNAME | |
valueFrom: | |
configMapKeyRef: # We specify that we want to use a ConfigMap to fetch the value | |
name: database-configs # the name of the ConfigMap | |
key: DATABASE_USERNAME # The key value used in the configmap | |
- name: DATABASE_PASSWORD | |
value: password | |
- name: DATABASE_NAME | |
valueFrom: | |
configMapKeyRef: # We specify that we want to use a ConfigMap to fetch the value | |
name: database-configs # the name of the ConfigMap | |
key: DATABASE_NAME # The key value used in the configmap | |
ports: # Ports to Expose | |
- containerPort: 8080 | |
readinessProbe: | |
initialDelaySeconds: 5 # Time before starting to Probe status | |
timeoutSeconds: 1 # Time to wait before timeout | |
# HTTP probe | |
httpGet: | |
path: / # the path we use to probe | |
port: 8080 | |
livenessProbe: | |
initialDelaySeconds: 5 # Time before starting to Probe status | |
timeoutSeconds: 1 # Time to wait before timeout | |
failureThreshold: 3 # How many times it can fail before restarting | |
# HTTP probe | |
httpGet: | |
path: / # the path we use to probe | |
port: 8080 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment