Kubernetes ports

There are three kinds of ports widely used in kubernetes resource management, for example:
port is the port exposed within the cluster. so other nodes/pods from same cluster can access it through service:port
targetPort is the port exposed from within the pod.
nodePort is the port exposed to outside world. so on public network, it could be accessed as public-ip:nodePort


kind: Service
apiVersion: v1
metadata:
labels:
app: nginx
name: nginx
spec:
ports:
- port: 443
targetPort: 443
- nodePort: 31234
selector:
app: nginx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s