Hi there, I tried to convert a docker-compose
file via konvert
with ports, but it seems it does not expose and publish ports.
Here is my simple docker-compose.yml
:
version: '3'
services:
nginx:
image: nginx
container_name: nginx
hostname: nginx
ports:
- '80:80'
And when I convert them, I see the below deployment
and service
yaml files as follows.
deployment
contents:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: nginx
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: nginx
spec:
containers:
- image: nginx:alpine
name: nginx
ports:
- containerPort: 80
resources: {}
hostname: nginx
restartPolicy: Always
status: {}
service
contents:
apiVersion: v1
kind: Service
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.22.0 (955b78124)
creationTimestamp: null
labels:
io.kompose.service: nginx
name: nginx
spec:
ports:
- name: "80"
port: 80
targetPort: 80
selector:
io.kompose.service: nginx
status:
loadBalancer: {}
Now that when I run docker ps
and kubectl get pods
, I see it’s running fine and I can even exec
into it but http://IP
does not work and I get connection refused error.
docker ps
contents:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0655811a5133 nginx "/docker-entrypoint.…" 11 minutes ago Up 11 minutes k8s_nginx_nginx-8488595897-s54d4_default_11ab5920-f21d-48ee-8d72-1955414fae14_0
dd03c5be3bde k8s.gcr.io/pause:3.4.1 "/pause" 11 minutes ago Up 11 minutes k8s_POD_nginx-8488595897-s54d4_default_11ab5920-f21d-48ee-8d72-1955414fae14_0
Am I doing anything wrong? Or I should add something to my deployment file?
I googled but it seems some of the solutions did not work.