Answer the question
In order to leave comments, you need to log in
Why do we use container port in Kubernetes?
Good afternoon,
such a stupid question arose, in the yaml code for pods we can specify the ports directive, for example:
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 80
name: nginx-port
Answer the question
In order to leave comments, you need to log in
in fact, the following yaml just shows that ports: has some informational value, because everything works on the 80th
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
spec:
selector:
matchLabels:
run: my-nginx
replicas: 2
template:
metadata:
labels:
run: my-nginx
spec:
containers:
- name: my-nginx
image: nginx
ports:
- containerPort: 8090
name: nginx-fake-port
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question