Created
February 28, 2022 13:02
-
-
Save Bhavesh0327/0d45040dc2492ce746cab6525c4d7771 to your computer and use it in GitHub Desktop.
K8 yml file to host ctf challenges over GCP using HaProxy
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 | |
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