-
-
Save nikhiljha/8509ac568bdcf3d28541fca281f3c15b to your computer and use it in GitHub Desktop.
Basic Kubernetes Examples (YAML Edition)
This file contains 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
# 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" |
This file contains 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: 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 |
This file contains 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: 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