Description of problem: Connect via ssh to a virtual machine that I have imported with the import-vm-apb, I can ssh to the VM which service is "virtctl expose" as NodePort type, but connection id refused if the type is ClusterIP or LoadBalancer. Version-Release number of selected component (if applicable): openshift v3.11.16, CNV 1.3, cnv13-tech-preview/import-vm-apb:1.3-1 How reproducible: Always Steps to Reproduce: 1. Expose different type of services for the VM $ virtctl expose vmi qwang-1 --port=5555 --node-port=30001 --target-port=22 --name=myvm-ssh --type=NodePort $ virtctl expose vmi qwang-1 --name=myvm-ssh-2 --port=5556 $ virtctl expose vmi qwang-1 --port=5557 --name=myvm-ssh-3 --type=LoadBalancer $ oc get service 2. ssh to the VM $ ssh <user>@<ip> -p <port> Actual results: 1. [cloud-user@cnv-executor-qwang-cnv13-master1 ~]$ oc get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE glusterfs-dynamic-vm-qwang-1-dv-01 ClusterIP 172.30.220.49 <none> 1/TCP 7d myvm-ssh NodePort 172.30.112.62 <none> 5555:30001/TCP 3d myvm-ssh-2 ClusterIP 172.30.85.71 <none> 5556/TCP 2d myvm-ssh-3 LoadBalancer 172.30.54.233 172.29.114.36,172.29.114.36 5557:31632/TCP 2d 2. [cloud-user@cnv-executor-qwang-cnv13-master1 ~]$ ssh cirros.112.62 -p 5555 cirros.112.62's password: $ [cloud-user@cnv-executor-qwang-cnv13-master1 ~]$ ssh cirros.85.71 -p 5556 ssh: connect to host 172.30.85.71 port 5556: Connection refused [cloud-user@cnv-executor-qwang-cnv13-master1 ~]$ ssh cirros.114.36 -p 5557 ssh: connect to host 172.29.114.36 port 5557: Connection refused Expected results: 2. Should ssh VM with type: ClusterIP and LoadBalancer Additional info:
Hey Roman, is Qixuan using virtctl expose correctly with ClusterIP and LoadBalancer modes? Thanks for your insight!
Hi, It looks like only on the first expose commaned `--target-port 22` was specified. It would also have worked, if `--port` would have been set to `22` for `ClusterIP` and `LoadBalancer`. At least from inside the cluster. Let me know if that resolves the issue.
@Qixuan I can not reproduce the issue with the vm example in https://github.com/kubevirt/kubevirt/blob/master/cluster/examples/vmi-ephemeral.yaml, ClusterIP, NodeIP and LoadBalancer mode are all working for me. could you please check your cmd is correct or not? or is there something wrong with your vm?
@Roman, yes, --target-port 22 needs to be exposed. Thanks. Here is a bug: https://bugzilla.redhat.com/show_bug.cgi?id=1644523 So I can close it.