Skip to content

Instantly share code, notes, and snippets.

@klg71
Last active Jun 4, 2021
Embed
What would you like to do?
Kubernetes Workshop in the MayopeCloud
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
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
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
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
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
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