postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

./client-setup.sh: pgouser-admin Secret not found in namespace: pgo

Open johnlinp opened this issue 2 years ago • 2 comments

Overview

Executing ./client-setup.sh will cause error with message pgouser-admin Secret not found in namespace: pgo.

Environment

Please provide the following details:

  • Platform: Kubernetes (minikube)
  • Platform Version: v1.26.0
  • PGO Image Tag: v.4.7.6

Steps to Reproduce

REPRO

Follow the quickstart: https://access.crunchydata.com/documentation/postgres-operator/4.7.6/quickstart/

  1. kubectl create namespace pgo
  2. kubectl apply -f https://raw.githubusercontent.com/CrunchyData/postgres-operator/v4.7.6/installers/kubectl/postgres-operator.yml
  3. curl https://raw.githubusercontent.com/CrunchyData/postgres-operator/v4.7.6/installers/kubectl/client-setup.sh > client-setup.sh
  4. chmod +x client-setup.sh
  5. ./client-setup.sh

EXPECTED

The pgo client should be installed.

ACTUAL

$ ./client-setup.sh
Operating System found is Darwin...
Downloading pgo-mac version: v4.7.6...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 37.5M  100 37.5M    0     0  5751k      0  0:00:06  0:00:06 --:--:-- 6458k
Error from server (NotFound): secrets "pgouser-admin" not found
pgouser-admin Secret not found in namespace: pgo
Please ensure that the PostgreSQL Operator has been installed.
Exiting...

johnlinp avatar Jul 28 '22 16:07 johnlinp

@johnlinp I am unable to replicate the error your are seeing.

We there any errors when the pgo-deploy Job ran to install PGO v4?

andrewlecuyer avatar Jul 30 '22 00:07 andrewlecuyer

Hi @andrewlecuyer,

Yes, you're right. There are errors in pgo-deploy pod:

$ kubectl -n pgo logs pgo-deploy-r4hdg
nss_wrapper: user exists
nss_wrapper: group exists
nss_wrapper: environment configured
[WARNING]: Found variable using reserved name: namespace

PLAY [Deploy Crunchy PostgreSQL Operator] **************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [pgo-preflight : include_tasks] *******************************************
included: /ansible/postgres-operator/roles/pgo-preflight/tasks/vars.yml for localhost

TASK [pgo-preflight : Check for "/conf/values.yaml"] ***************************
ok: [localhost]

TASK [pgo-preflight : fail] ****************************************************
skipping: [localhost]

TASK [pgo-preflight : include_vars] ********************************************
ok: [localhost]

TASK [pgo-preflight : fail] ****************************************************
skipping: [localhost]

TASK [pgo-preflight : Check Operating System] **********************************
changed: [localhost]

TASK [pgo-preflight : assert] **************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [pgo-preflight : assert] **************************************************
skipping: [localhost]

TASK [pgo-preflight : assert] **************************************************
skipping: [localhost]

TASK [pgo-preflight : assert] **************************************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [pgo-preflight : include_tasks] *******************************************
skipping: [localhost]

TASK [pgo-preflight : include_tasks] *******************************************
included: /ansible/postgres-operator/roles/pgo-preflight/tasks/check_kubernetes.yml for localhost

TASK [pgo-preflight : Check if the kubectl command is installed] ***************
changed: [localhost]

TASK [pgo-preflight : Ensure kubectl is installed] *****************************
ok: [localhost] => {
    "changed": false,
    "msg": "All assertions passed"
}

TASK [pgo-preflight : include_tasks] *******************************************
included: /ansible/postgres-operator/roles/pgo-preflight/tasks/check_vars.yml for localhost

TASK [pgo-preflight : Check if mandatory variables are defined] ****************
skipping: [localhost] => (item=pgo_operator_namespace) 
skipping: [localhost] => (item=pgo_installation_name) 
skipping: [localhost] => (item=pgo_admin_username) 
skipping: [localhost] => (item=pgo_admin_role_name) 
skipping: [localhost] => (item=pgo_admin_perms) 
skipping: [localhost] => (item=ccp_image_prefix) 
skipping: [localhost] => (item=ccp_image_tag) 
skipping: [localhost] => (item=pgo_image_prefix) 
skipping: [localhost] => (item=pgo_image_tag) 
skipping: [localhost] => (item=disable_auto_failover) 
skipping: [localhost] => (item=badger) 
skipping: [localhost] => (item=metrics) 
skipping: [localhost] => (item=archive_mode) 
skipping: [localhost] => (item=archive_timeout) 
skipping: [localhost] => (item=db_password_length) 
skipping: [localhost] => (item=create_rbac) 
skipping: [localhost] => (item=db_port) 
skipping: [localhost] => (item=db_replicas) 
skipping: [localhost] => (item=db_user) 
skipping: [localhost] => (item=backrest_storage) 
skipping: [localhost] => (item=backup_storage) 
skipping: [localhost] => (item=primary_storage) 
skipping: [localhost] => (item=replica_storage) 
skipping: [localhost] => (item=pgo_client_version) 
skipping: [localhost] => (item=pgbadgerport) 
skipping: [localhost] => (item=exporterport) 
skipping: [localhost] => (item=scheduler_timeout) 
skipping: [localhost] => (item=namespace_mode) 
skipping: [localhost] => (item=reconcile_rbac) 

TASK [pgo-operator : Set output directory fact] ********************************
ok: [localhost]

TASK [pgo-operator : Ensure output directory exists] ***************************
changed: [localhost]

TASK [pgo-operator : include_tasks] ********************************************
skipping: [localhost] => (item=openshift_auth.yml) 
skipping: [localhost] => (item=openshift.yml) 

TASK [pgo-operator : include_tasks] ********************************************
included: /ansible/postgres-operator/roles/pgo-operator/tasks/kubernetes_auth.yml for localhost => (item=kubernetes_auth.yml)
included: /ansible/postgres-operator/roles/pgo-operator/tasks/kubernetes.yml for localhost => (item=kubernetes.yml)

TASK [pgo-operator : Set the Kubernetes Context] *******************************
skipping: [localhost]

TASK [pgo-operator : Get Namespace Details] ************************************
changed: [localhost]

TASK [pgo-operator : Create PGO Namespace] *************************************
skipping: [localhost]

TASK [pgo-operator : Use kubectl or oc] ****************************************
ok: [localhost]

TASK [pgo-operator : include_tasks] ********************************************
included: /ansible/postgres-operator/roles/pgo-operator/tasks/namespace.yml for localhost

TASK [pgo-operator : Namespace List] *******************************************
ok: [localhost]

TASK [pgo-operator : Create Watched Namespaces] ********************************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Create Watched Namespaces (Reconcile RBAC)] ***************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Label Watched Namespaces (Reconcile RBAC)] ****************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Cleanup Local Namespace Target RBAC] **********************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Create Local Namespace Target RBAC] ***********************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Template Local Namespace RBAC] ****************************
skipping: [localhost]

TASK [pgo-operator : Cleanup Local Namespace Reconcile RBAC] *******************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : Create Local Namespace Reconcile RBAC] ********************
skipping: [localhost] => (item=pgo) 

TASK [pgo-operator : include_tasks] ********************************************
included: /ansible/postgres-operator/roles/pgo-operator/tasks/crds.yml for localhost

TASK [pgo-operator : Check if PGCluster CRD Is Installed] **********************
changed: [localhost]

TASK [pgo-operator : Create PGClusters CRD] ************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["kubectl", "create", "-f", "/ansible/postgres-operator/roles/pgo-operator/files/crds/pgclusters-crd.yaml"], "delta": "0:00:01.308225", "end": "2022-08-01 20:16:57.444871", "msg": "non-zero return code", "rc": 1, "start": "2022-08-01 20:16:56.136646", "stderr": "error: unable to recognize \"/ansible/postgres-operator/roles/pgo-operator/files/crds/pgclusters-crd.yaml\": no matches for kind \"CustomResourceDefinition\" in version \"apiextensions.k8s.io/v1beta1\"", "stderr_lines": ["error: unable to recognize \"/ansible/postgres-operator/roles/pgo-operator/files/crds/pgclusters-crd.yaml\": no matches for kind \"CustomResourceDefinition\" in version \"apiextensions.k8s.io/v1beta1\""], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
localhost                  : ok=21   changed=5    unreachable=0    failed=1    skipped=17   rescued=0    ignored=0   

Do you have any suggestions? Thanks.

johnlinp avatar Aug 01 '22 20:08 johnlinp

You're using K8s 1.26? Looks like The apiextensions.k8s.io/v1beta1 API version of CustomResourceDefinition is no longer served as of v1.22. -- but the Ansible installer for 4.7.6 is still using that for the CRDs. I need to raise this with the team, but just to unblock you, I think you might just be able to change apiextensions.k8s.io/v1beta1 to apiextensions.k8s.io/v1 for the CRD files.

--ref https://kubernetes.io/docs/reference/using-api/deprecation-guide/ --ex CRD file https://github.com/CrunchyData/postgres-operator/blob/REL_4_7/installers/ansible/roles/pgo-operator/files/crds/pgclusters-crd.yaml#L2

benjaminjb avatar Dec 29 '22 21:12 benjaminjb

Update on this: I'm not actually sure what I suggested above will work, but maybe a lower version of K8s. That said, v4 is somewhat outdated, so if you can, I'd recommend installing v5 directly, especially if you want a newer version of k8s. (v5.3.0 is tested on k8s 1.25, but I cannot right now guarantee that 1.26 will work out.)

Please reopen if you have further questions.

benjaminjb avatar Dec 29 '22 22:12 benjaminjb

Thanks for the explanation. I'll upgrade to v5 and give it a try.

johnlinp avatar Jan 03 '23 15:01 johnlinp