I have docker-compose.yml
version: '3.5'
services:
container-name:
image: container-image
ports:
- 80:80
- 443:443
And it creates the container with port forwarding to host machine. docker inspect container-name
[...]
NetworkSettings: {
[...]
Ports: {
443/tcp: [{ HostIp: 0.0.0.0, HostPort: 443 }]
80/tcp: [{ HostIp: 0.0.0.0, HostPort: 80 }]
}
[...]
}
[...]
But in the kubernetes next pod.yml, create container without ports.
kind: Pod
matadata:
name: pod-name
spec:
containers:
- image: container-image
name: container-name
ports:
- containerPort: 80
protocol: TCP
- containerPort: 443
protocol: TCP
[...]
In short, I need forward container(pod) port to host machine(node).
I found out that better to expose. But it doesn't work for me.