-
-
Save orsenthil/cf66a107d4ab554e3b9dde63d65f15e7 to your computer and use it in GitHub Desktop.
Example of NodePort service in Kubernetes
This file contains hidden or 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: 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
Step 1. Launch the above deployment.
Step 2. Create a curl pod to access this
Save as curl.yaml
Get to curl pod
External Access from curl pod
Acccess the service created above using Cluster-IP and Port