Skip to content

Instantly share code, notes, and snippets.

@thebongy
Last active August 2, 2020 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebongy/4132d8fcd93d1c7c6700584548960c6b to your computer and use it in GitHub Desktop.
Save thebongy/4132d8fcd93d1c7c6700584548960c6b to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: challenge-name # REPLACE challenge-name and challenge-category to your challenges's name and category
labels:
category: challenge-category # We assign labels to the deployment to link it to a service later, and to help manage deployments
challenge: challenge-name
spec:
replicas: 3 # The no of replicas sets the no of instances/pods of the challenge deployed on the cluster
selector:
matchLabels:
category: challenge-category
challenge: challenge-name
template:
metadata:
labels:
category: challenge-category
challenge: challenge-name
spec:
containers:
- name: challenge-container
image: gcr.io/project-id/challenge-image:tag # Set this URL to your challenge container's image
resources: # Resource limits for the container. These are important, in case people manage to max out CPU/RAM on your challenge
limits:
cpu: 100m
memory: 150Mi
requests:
cpu: 10m
memory: 30Mi
ports: # Port exposed by the container, you can add multiple
- containerPort: 9999
name: port-9999
---
apiVersion: v1
kind: Service
metadata: # Set the challenge-name/challenge-category SAME as the deployment, otherwise they won't link to each other
name: challenge-name
labels:
category: challenge-category
challenge: challenge-category
spec:
type: NodePort
selector:
category: challenge-category
challenge: challenge-name
ports:
- port: 9999 # The port exposed by the container
name: port-9999
targetPort: 9999 # The port exposed by the container
nodePort: 30001 # The port that is exposed on each Node on the cluster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment