Skip to content

Instantly share code, notes, and snippets.

@lvthillo
Created August 20, 2018 20:43
Show Gist options
  • Save lvthillo/96e0c2514329e5a1f1150fbc8a709ff9 to your computer and use it in GitHub Desktop.
Save lvthillo/96e0c2514329e5a1f1150fbc8a709ff9 to your computer and use it in GitHub Desktop.
Example of NodePort service in Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
selector:
matchLabels:
run: my-app
replicas: 2
template:
metadata:
labels:
run: my-app
spec:
containers:
- name: my-app
image: lvthillo/python-flask-docker
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: my-app
labels:
run: my-app
spec:
type: NodePort
ports:
- port: 8080
protocol: TCP
selector:
run: my-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment