Skip to content

Instantly share code, notes, and snippets.

@discdiver
Last active April 7, 2019 12:59
Show Gist options
  • Save discdiver/cc5ba0e73e49a79560405206a3dfd29c to your computer and use it in GitHub Desktop.
Save discdiver/cc5ba0e73e49a79560405206a3dfd29c to your computer and use it in GitHub Desktop.
apiVersion: apps/v1 # Deployments get an "apps/v1" - no longer in beta.
kind: Deployment # kind is for the type of resource.
metadata: # metadata provides information about the resource.
name: my-deployment # We name our Deployment my-deployment.
#This is the value at metadata.name.
spec:
replicas: 3 # Specify we want 3 Pods in our ReplicaSet.
selector:
matchLabels: # spec.selector.matchLabels tells the Deployment
app: my-app # to match Pods with a key - value label pair
# equal to app - my-app.
template: # The template section specifies info for the Pods.
metadata:
labels:
app: my-app # spec.template.metadata.labels.app
# my-app is the label for the Pods.
spec:
containers: # Info about the containers the Pods will run.
# Make a name for containers.
- name: my-container # Must be a list item.
# The image will be found at this location.
# Must be a map.
image: gcr.io/hello-minikube-zero-install/hello-node
---
# Multiple resources need --- between them.
apiVersion: v1 # Note, no "apps/" for Services.
kind: Service # The type of resource is a Service.
metadata:
name: my-service # Making up a name for the Service
spec:
selector: # Tell the Service the group of Pods to use.
app: my-app # The Service will attach to Pods with the
# key - value pair app - my-app.
ports: # The external port number for the Service.
# Your app will run on to localhost:8080.
- port: 8080 # Must be a list item.
# The type of Service to create.
type: LoadBalancer # Must be a map.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment