Connect to your cluster and access Kubernetes pods
Connect to a cluster
On the Google Cloud Platform, go to the cluster where you installed the Bitpoke App (Kubernetes Engine -> Clusters and make sure you have the right project selected):
Click on the
Connect button corresponding to the cluster you want to connect to and you’ll see several possibilities to connect to your cluster:
- via command-line, either from the Google Cloud Shell or from your own local setup
- via the Cloud Console dashboard, where you can view the workloads running in your cluster
1. Connect to your cluster in Google Cloud Shell
Click on the
Run in Cloud Shell button and you’ll connect to your cluster by using the Google Cloud Shell, which will open the Cloud Shell terminal and automatically fill in the command line displayed above.
2. Connect to your cluster from your own computer
You can easily connect to your cluster and run Kubernetes commands from your own terminal. Before using the same command line access displayed above, you need to have installed:
After these are installed, just copy and paste in your terminal the command line above for connecting to your cluster, for example:
gcloud container clusters get-credentials standard-cluster-1 --region us-central1-a --project testing-reactor
Access the Kubernetes pods
Once you are connected to the cluster you can access the pods of your site.
Each site runs in its own namespace, which you can see in the Bitpoke App, under
Sites - Runtime
. In the example presented here the project namespace is
To see all the pods that run in a certain namespace run:
kubectl get pod -n <your_namespace>
You will see something like:
NAME READY STATUS RESTARTS AGE default-mysql-0 4/4 Running 0 5h22m prometheus-prom-proj-0 3/3 Running 0 5h22m prometheus-prometheus-0 3/3 Running 1 20h mysite-presslabs-ajj0r-6f44fd564d-7wld2 3/3 Running 0 5h22m mysite-presslabs-ajj0r-memcached-0 2/2 Running 0 20h
WP-CLI and any files of the site can be accessed by using the WordPress container from the instance’s pod, which in this case is
To aceess a pod run:
kubectl exec -it -n <your_namespace> <pod_name> -- bash
Don’t forget to replace
<pod_name>. For the example above, if you want to access the WordPress pod you’ll run:
kubectl exec -it -n proj-f3y745 mysite-presslabs-ajj0r-6f44fd564d-7wld2 -- bash
Now you can use WP-CLI commands, e.g. list all installed plugins:
wp plugin list
As a shortcut version, you can also run WP-CLI using the commands from Commands - Run WP-CLI , which already contain your project namespace, so all you have to do is connect to your cluster and run these commands.
If you need to access the database pod, see the commands from Commands - connect to the database .
Read more about kubectl here.