Warning: Even though you have access to these various databases, it is NOT suggested to alter any of these databases directly. If you have any doubt about the following steps, please contact VMware Support and perform the following steps under their guidance.
With a fully deployed VMware Tanzu Kubernetes Grid Integrated Edition environment, there are many VMs and databases associated with the environment and sometimes it is necessary to access those VMs and databases for troubleshooting purposes.
This article explains how to access most of these VMs & databases (DBs). Please note that this article assumes you have enough knowledge of those associated VMs and DBs which is why we are not trying to explain the role of each VMs & databases.
Prerequisites
Following instructions are about how to access the VMs and Databases for VMware Tanzu Kubernetes Grid Integrated Edition.
1. SSH into Ops Manager & access tempest_production
database
SSH into your Ops Manager VM
Use the ssh private key to connect to the Ops Manager VM. This private key is the pair to the public key that was used to deploy your Ops Manager VM.
$ ssh -i ssh.key [email protected]
Access then tempest_production
databases on PostgreSQL
ubuntu@opsman:~$ sudo -u tempest-web psql tempest_production
tempest_production=# \d List of relations Schema | Name | Type | Owner --------+-----------------------------------------+----------+------------- public | application_unlock_infos | table | tempest-web public | application_unlock_infos_id_seq | sequence | tempest-web public | ar_internal_metadata | table | tempest-web :
2. SSH into VMware Tanzu Kubernetes Grid Integrated Edition UAA/API Server and Access MySQL DB
Login to the PKS DB VM using the 'bosh ssh' command
$ bosh -e pks vms :
Deployment 'pivotal-container-service-XXXXX8f4b97c382d89cd'
Instance Process State AZ IPs VM CID VM Type Active Stemcell
pivotal-container-service/XXXXXcba-076c-4421-8e20-5812be2b82c9 running az1 172.XX.XX.XX vm-XXXXXcf2-c32c-4c08-80a7-fddfb31ecbee large.disk true bosh-vsphere-esxi-ubuntu-jammy-go_agent/1.423
pks-db/XXXX95dd-979c-4bca-be63-808c48e8a05d running az1 172.XX.XX.XX vm-XXXXX9c4-e774-4e06-a878-a03306547ab2 large.disk true bosh-vsphere-esxi-ubuntu-jammy-go_agent/1.423
2 vms
:
$ bosh -e pks -d pivotal-container-service-XXXXX8f4b97c382d89cd ssh pks-db/XXXXX95dd-979c-4bca-be63-808c48e8a05d
Access MySQL DB
Get the MySQL root password from VMware Tanzu Kubernetes Grid Integrated Edition tile -> Credentials -> Mysql Admin password.
pks-db/XXXXX95dd-979c-4bca-be63-808c48e8a05d:~$ sudo su vcap
pks-db/XXXXX95dd-979c-4bca-be63-808c48e8a05d:~$ mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | pks | | uaa | +--------------------+
3. SSH into Kubernetes Master and Access etcd database
SSH into a Kubernetes master
$ bosh -e pks -d service-instance_XXXXX55e-40e3-41ad-b141-e45ab0af62a9 ssh master/XXXXX333-4f46-4ce6-939f-099f2c6b0d7c Using environment '10.XX.XX.XX' as user 'director' (bosh.*.read, openid, bosh.*.admin, bosh.read, bosh.admin) Using deployment 'service-instance_XXXXX55e-40e3-41ad-b141-e45ab0af62a9' : : master/XXXXX333-4f46-4ce6-939f-099f2c6b0d7c:~$ sudo -i master/XXXXX333-4f46-4ce6-939f-099f2c6b0d7c:~#
Access etcd key-value datastore
Access Cluster Objects using API v3
** etcdctl
v3 command reference - https://etcd.io/docs/v3.5/tutorials/
master/XXXXX333-4f46-4ce6-939f-099f2c6b0d7c:~# ETCDCTL_API=3 /var/vcap/jobs/etcd/bin/etcdctl get '' --keys-only --prefix : /registry/services/specs/default/kubernetes /registry/services/specs/kube-system/heapster /registry/services/specs/kube-system/kube-dns /registry/services/specs/kube-system/kubernetes-dashboard :
4. SSH into Harbor VM, containers and access its DB
SSH into Harbor VM
$ bosh -e pks vms : Deployment 'harbor-container-registry-XXXXXadfd44a90f27cb3' Instance Process State AZ IPs VM CID VM Type harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842 running AZ1 10.XX.XX.XX vm-XXXXX8a5-acd7-4769-a731-617b0de04dd5 large.disk : $ bosh -e pks -d harbor-container-registry-XXXXXadfd44a90f27cb3 ssh harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842 : harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842:~$ sudo -i harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842:~# alias docker='/var/vcap/packages/docker/bin/docker -H unix:///var/vcap/sys/run/docker/dockerd.sock' harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842:~# docker ps CONTAINER ID IMAGE ... NAMES ba8e4bbbd70e vmware/nginx-photon:v1.4.0 ... nginx 248ceeb87c92 vmware/harbor-jobservice:v1.4.0 ... harbor-jobservice bc7dc8a03068 vmware/notary-server-photon:v0.5.1-v1.4.0 ... notary-server f2714da1da31 vmware/harbor-ui:v1.4.0 ... harbor-ui 71a87d716636 vmware/clair-photon:v2.0.1-v1.4.0 ... clair 15f4b712bcd4 vmware/notary-signer-photon:v0.5.1-v1.4.0 ... notary-signer a09f5a207347 vmware/harbor-db:v1.4.0 ... harbor-db 26f720f46929 vmware/registry-photon:v2.6.2-v1.4.0 ... registry 78cae10c3831 vmware/harbor-adminserver:v1.4.0 ... harbor-adminserver 3e93a18f6cb5 vmware/harbor-log:v1.4.0 ... harbor-log
Access the Harbor DB
harbor-app/XXXXXb5a-cd39-4b71-bb66-a08184ae9842:~# docker exec -it harbor-db bash
postgres [ / ]$ psql -U postgres
psql (13.12)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
--------------+----------+----------+-------------+-------------+-----------------------
notaryserver | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | server=CTc/postgres
notarysigner | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres+
| | | | | signer=CTc/postgres
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
registry | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(6 rows)
postgres=#