alibaba / kt-connect

A toolkit for Integrating with your kubernetes dev environment more efficiently
https://alibaba.github.io/kt-connect/#/
GNU General Public License v3.0
1.48k stars 231 forks source link

target port xx not exists in service xxx #367

Closed fly2tomato closed 1 year ago

fly2tomato commented 1 year ago

when I use ktctl exchange -n {namespace} my-service --expose 10019:80 -d to exchange my service, which failed as following: 12:37PM DBG Background task log to /tmp/kt-2042186752 12:37PM INF Using cluster context xxx 12:37PM INF KtConnect 0.3.6 start at 29127 (linux amd64) 12:37PM DBG Rectify pod kt-rectifier-nrtgk created 12:37PM INF Fetching cluster time ... 12:37PM DBG Execute command [date +%s] in kt-rectifier-nrtgk:standalone 12:37PM DBG No time difference 12:37PM INF Using selector mode 12:37PM DBG Service target ports: [10019] 12:37PM ERR Exit: target port 80 not exists in service xx 12:37PM DBG Cleaning workspace 12:37PM INF Removed pid file xxx

here is the service: my-service ClusterIP 192.168.9.76 <none> 80/TCP 72d

Environment (please complete the following information):

Additional context need help to figure it out why.

fly2tomato commented 1 year ago

resolved.

The --expose port should be the target port in service, namely, spec.ports.targetPort instead of the service port (spec.ports.port)