kubernetes-up-and-running / kuard

Demo app for Kubernetes Up and Running book
Apache License 2.0
1.59k stars 543 forks source link

ssh tunneling issue on gcloud #24

Closed Birtanay closed 5 years ago

Birtanay commented 5 years ago

OS : Windows 10 GCloud SDK I exposed alpaca-prod by following instructions. You can see the specs of the service:

Name: alpaca-prod Namespace: default Labels: app=alpaca env=prod ver=1 Annotations: Selector: app=alpaca,env=prod,ver=1 Type: NodePort IP: 10.39.255.181 Port: 8080/TCP TargetPort: 8080/TCP NodePort: 31824/TCP Endpoints: 10.36.0.24:8080,10.36.1.18:8080,10.36.2.17:8080 Session Affinity: None External Traffic Policy: Cluster Events:

nodes are: kubectl get nodes NAME STATUS ROLES AGE VERSION gke-kuar-cluster-default-pool-1ef29ffa-5cms Ready 12d v1.9.7-gke.11 gke-kuar-cluster-default-pool-1ef29ffa-trv0 Ready 12d v1.9.7-gke.11 gke-kuar-cluster-default-pool-1ef29ffa-vr99 Ready 12d v1.9.7-gke.11

When I try to run ssh tunneling command it says

ssh gke-kuar-cluster-default-pool-1ef29ffa-5cms -L 8080:localhost:31824 omer@gke-kuar-cluster-default-pool-1ef29ffa-5cms: Permission denied (publickey).

jbeda commented 5 years ago

Hi @Birtanay -- I'm not sure what is going on here. It looks like you are having ssh key problems. Without any more information I'm not sure I can help. I'm not sure what guides you are following to create that tunnel. I'm thinking that perhaps this is from chapter 7 of the book?

I'd try doing the ssh through gcloud as it helps to automatically set up ssh keys correctly. I haven't tried in on windows but I'd do gcloud compute ssh <VM name> -L 8080:localhost:31824.

medoror commented 4 years ago

For any other lurkers this syntax worked for me

gcloud compute ssh <VM name> --project <gcp project> --zone <zone> -- -L 8080:localhost:<node port exposed by service>

You may have to additionally update ssh keys. More info about this can be found here