4

How can I access through ssh to the machine running the Kubernetes Engine?

How can I check a public IP of the machines running the Kubernetes engine?

GalloCedrone
  • 371
  • 1
  • 9
ThangTQ
  • 41
  • 1
  • 2
  • Are you trying to ssh into the machine running the control plane or into a node? Are you checking the public IP of the cluster endpoint (e.g. where the Kubernetes API server is serving) or the public IP of a VM of a node in the cluster? – Robert Bailey May 07 '18 at 23:19
  • My kubernetes info as below, it has a public ip , but i can't access to port 22, telnet is also cann't as well.: Kubernetes clusters bigdata-stream Cluster Master version 1.8.8-gke.0 Endpoint 35.234.12.14 – ThangTQ May 08 '18 at 14:10

3 Answers3

4

How can I access through ssh to the machine running the Kubernetes Engine?

gcloud compute ssh NODE-NAME --zone ZONE

Note: With this you access to the node. You can't access the master node, as it is Google managed.

How can I check a public IP of the machines running the Kubernetes engine?

kubectl get no -o wide

To know master node IP address:

kubectl cluster-info | grep master
suren
  • 161
  • 4
1

Since you are using Google Kubernetes Engine each node is simply a compute engine instance that therefore you can access:

  • from the console clicking on the button SSH

  • making use of gcloud compute ssh [...] command

Here you can find a guide showing you how to do it step to step.

Therefore you will not need to know the public IP address in this case if you are connecting from a terminal where google SDK is installed.


However in order to know the public IP of a node simply check the relative column in the console navigating thorughComputeEngine->Instances or run $ gcloud compute instances list

On the other hand if you are interested in knowing the public IP of the master you can check it running:

$ kubectl describe endpoints kubernetes

or

$ kubectl cluster-info

...But since it is managed by Google you cannot access it.

GalloCedrone
  • 371
  • 1
  • 9
0

Google Kubernetes Engine provides a managed control plane for your Kubernetes cluster. Therefore you don't have access to a particular machine running the control plane that you can access.

The endpoint for your cluster is the address at which the Kubernetes API is exposed and used to control your cluster.

Robert Bailey
  • 599
  • 3
  • 6
  • Thanks guys. I deployed a service (expose on port 8080) with a command: kubectl create -f service.yaml. How can I access the service from public ? – ThangTQ May 12 '18 at 01:41
  • Thanks you. One more , I saw in my kubernetes instance with an Endpoint 35.234.12.14 and credentials (username/password: admin/x...). what is purposes of the credential ? and How to use the credentials ? – ThangTQ May 12 '18 at 01:46
  • Have you opened a firewall rule to allow access to port 8080 on your VMs? – Robert Bailey May 13 '18 at 15:30
  • The credentials are used by kubectl to access the Kubernetes apiserver. You can also use them directly if you want to access the api using `curl` or a custom client. – Robert Bailey May 13 '18 at 15:30