Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active August 10, 2022 19:11
Show Gist options
  • Save percybolmer/7697ceeb73208667e2a91bf137e9b94f to your computer and use it in GitHub Desktop.
Save percybolmer/7697ceeb73208667e2a91bf137e9b94f to your computer and use it in GitHub Desktop.
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
envFrom: # Use this to assign a whole ConfigMap
- configMapRef:
name: database-configs # Just specify your configmap name
env:
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef: # This is used to fetch value from secret, should be base64 encoded
name: database-secrets # Name of our secrets object
key: DATABASE_PASSWORD # The secret key to fetch value from
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