Skip to content

Instantly share code, notes, and snippets.

@dyrnq
Forked from lvthillo/deployment.yaml
Last active June 30, 2022 15:12
Show Gist options
  • Select an option

  • Save dyrnq/42ae1547973337b2f793a185671d2a3f to your computer and use it in GitHub Desktop.

Select an option

Save dyrnq/42ae1547973337b2f793a185671d2a3f 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: 4
template:
metadata:
labels:
run: my-app
spec:
containers:
- name: my-app
image: nginx:1.22.0
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: my-app
labels:
run: my-app
spec:
type: NodePort
ports:
- nodePort: 30163
port: 8080
targetPort: 80
selector:
run: my-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment