0

On the github action I login to Azure CLI and then Connect to the cluster by following commands:

az login
az aks get-credentials --resource-group $AKS_PERS_RESOURCE_GROUP --name $AKS_CLUSTER_NAME

enter image description here

Then I Connect to kubernete pods by following command

kubectl exec -it mypod -- //bin/bash

If you use the -it flag on the local machine, there should be no problem. However, when running on Github action, it will have a warning:

Unable to use a TTY - input is not a terminal or the right kind of file

enter image description here

Then I Connect to postgres localhost by following command.

psql -h  127.0.0.1  -p 5432 -d postgres -U postgres

I tried removing the -t flag according to some tutorials but it didn't work. enter image description here

This means cannot connect to kubernete pods. In fact, when I connect with my local computer, it succeeds

enter image description here

CSE
  • 31
  • 9
  • 1
    Running with `-it` in a CI environment makes no sense. With `-it`, you're saying you want to have an interactive tty, and you'll be expected to give it some input. – rethab Mar 23 '22 at 13:11
  • yes, i need to exetute command psql -h 127.0.0.1 -p 5432 -d postgres -U postgres after entering pod – CSE Mar 23 '22 at 15:59
  • And then what? I mean this psql command just connects you to the database, but you'd still need to enter an SQL query or something. What are you trying to achieve? Run some query? – rethab Mar 24 '22 at 06:51
  • After I initialize the DB , I need to create an external user to be able to manipulate the DB. hence I used command : psql -h 127.0.0.1 -p 5432 -d postgres -U postgres and then , i will create an external user – CSE Mar 24 '22 at 12:33
  • If you want to run some setup for your database and you're using the official postgres image, perhaps this could be helpful: https://stackoverflow.com/a/26599273/1080523 – rethab Mar 24 '22 at 12:36

0 Answers0