Skip to content

Instantly share code, notes, and snippets.

@pedroyan
Last active January 31, 2020 22:22
Show Gist options
  • Save pedroyan/440fe3e00841e08fce1cb860641af86c to your computer and use it in GitHub Desktop.
Save pedroyan/440fe3e00841e08fce1cb860641af86c to your computer and use it in GitHub Desktop.
Yaml file used on my Kubernetes tutorial
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mymicroservice
spec:
replicas: 2
selector:
matchLabels:
app: mymicroservice
template:
metadata:
labels:
app: mymicroservice
spec:
containers:
- name: mymicroservice
image: helloworldmicroservice
imagePullPolicy: IfNotPresent #Very important!
ports:
- containerPort: 80 #Application will be available in this port on the container
env:
- name: ASPNETCORE_URLS
value: http://*:80
---
apiVersion: v1
kind: Service
metadata:
name: mymicroservice
spec:
type: NodePort
ports:
#Container port that will be exposed
- port: 80
#Node port that will expose the container to the public. Outside consumers connect to this port (i.e: 172.78.0.2:31000)
nodePort: 31000
selector:
app: mymicroservice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment