Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to Valkey when using password from existing secret #31009

Closed
franz-dalitz opened this issue Dec 12, 2024 · 18 comments
Closed

Can't connect to Valkey when using password from existing secret #31009

franz-dalitz opened this issue Dec 12, 2024 · 18 comments
Assignees
Labels
solved tech-issues The user has a technical issue about an application valkey

Comments

@franz-dalitz
Copy link

franz-dalitz commented Dec 12, 2024

Name and Version

bitnami/valkey 2.2.0

What architecture are you using?

None

What steps will reproduce the bug?

Environment: Rancher managed RKE2 clusters running on OpenSUSE Leap with applications managed by ArgoCD + Kustomize.

I created the secret "valkey" with the "password" field by just writing a secret manifest and applying it to the cluster in the same namespace as my valkey:

apiVersion: v1
kind: Secret
type: Opaque
metadata:
  name: valkey
data:
  password: my_password_in_base64

This is my kustomization:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
helmCharts:
- name: valkey
  repo: oci://registry-1.docker.io/bitnamicharts
  releaseName: valkey
  version: 2.2.0
  valuesFile: ../../../base/valkey/values.yaml
  namespace: dev

I then tried to connect to valkey-primary using a client container as described in one of the valkey guides: https://valkey.io/blog/using-bitnami-valkey-chart/

kubectl run --namespace dev valkey-client --restart='Never' --env VALKEY_PASSWORD=my_valkey_password  --image docker.io/bitnami/valkey:8.0.0-debian-12-r0 --command -- sleep infinity
kubectl exec --tty -i valkey-client --namespace dev -- bash

Then doing valkey-cli -h valkey-primary and auth my_password.

Are you using any custom parameters or values?

this is my values.yaml file content:

global:
  defaultStorageClass: local-path

auth:
  enabled: true
  usePassword: true
  existingSecret: valkey
  existingSecretPasswordKey: password

What is the expected behavior?

I'd assume a connection to be established successfully, then being able to test the setting and getting of values.

What do you see instead?

I get the following error: (error) WRONGPASS invalid username-password pair or user is disabled., even though I made sure of course, that namespaces and my chosen password are identical across all places.
Checking the valkey-primary-0 pod with printenv I can see that the VALKEY_PASSWORD env var is correct, yet connecting doesn't work.

Additional information

I had Valkey deployed with its own password generation before, which worked flawlessly, though either valkey rotates passwords sometimes or there is an issue on my end with Argo, but since the password kept changing other pods using Valkey would lose the initially correct password and the ability to connect to Valkey, so I assumed this is what I need to do.
I also tested the password file version as suggested on the artifacthub page: https://artifacthub.io/packages/helm/bitnami/valkey but that didn't work, exactly the same issue.

@franz-dalitz franz-dalitz added the tech-issues The user has a technical issue about an application label Dec 12, 2024
@github-actions github-actions bot added the triage Triage is needed label Dec 12, 2024
@carrodher
Copy link
Member

Is this your first deployment? Please note that Helm does not automatically remove PVs/PVCs when uninstalling Helm charts. If you reinstall the chart using the same name and/or namespace, there may be a conflict between the password stored in the PV from the initial deployment and the new random password generated during subsequent installations.

To avoid this conflict, you can:

  • Pass the original password as a parameter during the installation.
  • Use a different name or namespace for the new deployment.
  • Manually remove the PVs/PVCs from the previous deployment.

@franz-dalitz
Copy link
Author

franz-dalitz commented Dec 13, 2024

it's not my first deployment since i had it running before, when it was managing its password itself.
whenever i tried to reinstall though i cleared the pvcs in rancher and saw how their volumes were removed and then created again, so i'm sure each attempt started with a blank pv.

@carrodher
Copy link
Member

Can you reproduce the issue by installing the Helm chart in a brand new namespace?

@franz-dalitz
Copy link
Author

yes, bypassing argo, just going raw from the master node via kubectl kustomize with the same files after creating a new namespace, the same thing happens.

@github-actions github-actions bot removed the triage Triage is needed label Dec 17, 2024
@github-actions github-actions bot assigned alvneiayu and unassigned carrodher Dec 17, 2024
Copy link

github-actions bot commented Jan 2, 2025

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

@github-actions github-actions bot added the stale 15 days without activity label Jan 2, 2025
Copy link

github-actions bot commented Jan 7, 2025

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

@github-actions github-actions bot added the solved label Jan 7, 2025
@bitnami-bot bitnami-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2025
@franz-dalitz
Copy link
Author

this still doesn't work for me. i updated my chart version to 2.2.1 and get the same error.

@franz-dalitz
Copy link
Author

franz-dalitz commented Jan 8, 2025

and the same happens when i use a password file instead.
am i missing some sort of setting?
is maybe simply somehow the default user disabled when using one of these two options?
using auth.password works just fine...

@franz-dalitz
Copy link
Author

the global.auth.password variant documented on the artifacthub page also does not work for me, only exactly the auth.password option.

@carrodher carrodher reopened this Jan 8, 2025
@carrodher carrodher added in-progress and removed stale 15 days without activity solved labels Jan 8, 2025
@github-actions github-actions bot added triage Triage is needed and removed in-progress labels Jan 8, 2025
@github-actions github-actions bot removed the triage Triage is needed label Jan 8, 2025
@github-actions github-actions bot assigned juan131 and unassigned carrodher Jan 8, 2025
@carrodher carrodher assigned alvneiayu and unassigned juan131 Jan 8, 2025
@github-actions github-actions bot assigned migruiz4 and unassigned alvneiayu Jan 8, 2025
@carrodher carrodher assigned alvneiayu and unassigned migruiz4 Jan 8, 2025
@juan131
Copy link
Contributor

juan131 commented Jan 10, 2025

Hi @franz-dalitz

I was unable to reproduce the issue. These are the steps I followed:

  • I created a secret my-valkey-secret with a password key
$ kubectl create secret generic my-valkey-secret --from-literal=password=some_password
$ kubectl get secret my-valkey-secret -o json | jq -r .data
{
  "password": "c29tZV9wYXNzd29yZA=="
}
  • Then, I installed the Bitnami Valkey chart configuring it to use the existing secret:
helm install valkey oci://registry-1.docker.io/bitnamicharts/valkey --set auth.existingSecret=my-valkey-secret --set auth.existingSecretPasswordKey=password
  • Finally, I followed the installation notes to create a client a connect to Valkey and set some key:
$ kubectl run --namespace default valkey-client --restart='Never'  --env VALKEY_PASSWORD=some_password --image docker.io/bitnami/valkey:8.0.2-debian-12-r0 --command -- sleep infinity
$ kubectl exec --tty -i valkey-client --namespace default -- bash
I have no name!@valkey-client:/$ REDISCLI_AUTH="$VALKEY_PASSWORD" valkey-cli -h valkey-primary
valkey-primary:6379> set foo bar
OK
valkey-primary:6379> get foo
"bar"
valkey-primary:6379> exit
I have no name!@valkey-client:/$ REDISCLI_AUTH="$VALKEY_PASSWORD" valkey-cli -h valkey-replicas
valkey-replicas:6379> get foo
"bar"

@franz-dalitz
Copy link
Author

i don't know what to make of this, maybe it's a problem with kustomize-helm interactions then...

@juan131
Copy link
Contributor

juan131 commented Jan 16, 2025

@franz-dalitz are you positive the password was properly base64-encoded when creating the secret? This is a common issue.

@franz-dalitz
Copy link
Author

i am, as described i can even verify that the password is present as an environment variable via printenv

@franz-dalitz
Copy link
Author

just verified my error once more to make sure i'm not confused. did everything from before again, wiped the pvs once more, confirmed the password is in the env vars via printenv, yet it doesn't work.

@juan131
Copy link
Contributor

juan131 commented Jan 16, 2025

Hi @franz-dalitz

I'm afraid I'm not able to reproduce the issue and I don't really know what could be wrong based on what you shared. Could you try creating the secret using the kubectl command below? Please update the XXXXX with whatever password you want to use:

kubectl create secret generic valkey --namespace dev --from-literal=password=XXXXX

@franz-dalitz
Copy link
Author

doing that it works just fine, that's weird... i am absolutely certain what i used was encoded base64 just fine, when i sent it through base64 -d it came out exactly as it was supposed to.

@franz-dalitz
Copy link
Author

i suppose i can close this then, thank you for your help, i appreciate your time very much

@juan131
Copy link
Contributor

juan131 commented Jan 17, 2025

I'm glad you were able to solve the issue!

@juan131 juan131 assigned juan131 and unassigned alvneiayu Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solved tech-issues The user has a technical issue about an application valkey
Projects
None yet
Development

No branches or pull requests

6 participants