I have GKE cluster with database deployment. I would like to access a database service from my CI Build pipeline to update the database state. I am able to access this service from my laptop via port-forwarding, but how can I do that from CI Build step?
For example, I am using port-forwarding from my laptop like this:
kubectl port-forward --namespace=database deployment/postgresql-1-postgresql-deployment 5432:5432
I tried to run above command to forward a port in one of the preceding step, before I run the next step where access to database is needed, but I think this is useless since CI steps are isolated and running in different containers (as far as I understood).
- name: 'gcr.io/cloud-builders/kubectl' entrypoint: 'sh' args: - '-c' - | kubectl port-forward --namespace=database deployment/postgresql-1-postgresql-deployment 5432:5432 &