Skip to content

Instantly share code, notes, and snippets.

@nikhiljha
Last active December 27, 2020 05:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikhiljha/8509ac568bdcf3d28541fca281f3c15b to your computer and use it in GitHub Desktop.
Save nikhiljha/8509ac568bdcf3d28541fca281f3c15b to your computer and use it in GitHub Desktop.
Basic Kubernetes Examples (YAML Edition)
# Notice how this has the same variables over
# and over again... One of the reasons why YAML is not the tool
# for the job (in hindsight).
apiVersion: apps/v1
kind: Deployment
metadata:
name: echo
labels:
app: echo
spec:
replicas: 1
selector:
matchLabels:
app: echo
template:
metadata:
labels:
app: echo
spec:
containers:
- name: echo
image: k8s.gcr.io/echoserver:1.4
ports:
- containerPort: 8080
resources:
requests:
memory: "100Mi"
cpu: "0.5"
limits:
memory: "128Mi"
cpu: "0.65"
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: echo
spec:
rules:
- host: "echo.example.com"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: echo
port:
number: 8080
apiVersion: v1
kind: Service
metadata:
name: echo
spec:
selector:
app: echo
ports:
- protocol: TCP
port: 8080
targetPort: 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment