Last active
June 4, 2021 11:22
-
-
Save klg71/68d9949e9131bb2066a3536626a4904c to your computer and use it in GitHub Desktop.
Kubernetes Workshop in the MayopeCloud
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: apps/v1 | |
kind: Deployment | |
metadata: | |
name: hello-world | |
spec: | |
selector: # These labels have to match those configure under template.metadata.labels | |
matchLabels: | |
app: hello-world | |
template: | |
metadata: | |
labels: # These are the labels assigned to the pod so it can be identified | |
app: hello-world | |
spec: | |
containers: | |
- name: hello-world | |
image: nginxdemos/hello | |
ports: | |
- name: web | |
containerPort: 80 | |
protocol: TCP |
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: apps/v1 | |
kind: Deployment | |
metadata: | |
name: hello-world | |
spec: | |
selector: | |
matchLabels: | |
app: hello-world | |
template: | |
metadata: | |
labels: | |
app: hello-world | |
spec: | |
containers: | |
- name: hello-world | |
image: klg71/mayopedemoapp:latest | |
ports: | |
- name: http | |
containerPort: 8080 | |
resources: | |
requests: | |
memory: 500Mi | |
cpu: 0.5 | |
limits: | |
memory: 500Mi | |
cpu: 0.5 |
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: apps/v1 | |
kind: Deployment | |
metadata: | |
name: hello-world | |
spec: | |
selector: | |
matchLabels: | |
app: hello-world | |
template: | |
metadata: | |
labels: | |
app: hello-world | |
spec: | |
containers: | |
- name: hello-world | |
image: klg71/mayopedemoapp:latest | |
ports: | |
- name: http | |
containerPort: 8080 | |
env: | |
- name: INSTANCE_NAME | |
value: nautilus | |
resources: | |
requests: | |
memory: 500Mi | |
cpu: 0.5 | |
limits: | |
memory: 500Mi | |
cpu: 0.5 |
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: hello-world | |
spec: | |
rules: | |
- host: hello-world-1e7bdecd-8f67-4329-bc49-08784410c2de.dyn.mayope.net | |
http: | |
paths: | |
- path: / | |
pathType: "Prefix" | |
backend: | |
service: | |
name: "hello-world" | |
port: | |
number: 80 |
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: Pod # Kind of resource to deploy | |
metadata: # general information about our resource | |
name: hello-world | |
spec: | |
containers: | |
- name: hello-world | |
image: nginxdemos/hello # Docker Image to deploy | |
ports: # Ports exposed by this container | |
- name: web | |
containerPort: 80 | |
protocol: TCP |
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: hello-world # This is also the dns name where this service is reachable within the same namespace | |
spec: | |
ports: | |
- name: http # This port in this service is named 'http' | |
port: 80 # It exposes itself on port 80 | |
protocol: TCP # It uses the TCP protocol | |
targetPort: 80 # It will target the port 80 in the matching container | |
selector: # All containers matching this label will be considered for traffic | |
app: hello-world | |
# There are several types of services ClusterIP assigns the service an ip in the cluster | |
# ClusterIP services are only exposed within the cluster which is enough for this use case | |
type: ClusterIP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment