Skip to content

Error: etcdserver: user name is empty when auth.rbac.enabled set to false #2433

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

Closed
Diluka opened this issue Apr 27, 2020 · 13 comments
Closed
Labels
stale 15 days without activity

Comments

@Diluka
Copy link

Diluka commented Apr 27, 2020

Which chart:
The name (and version) of the affected chart
bitnami/etcd:3.4.7
Describe the bug
A clear and concise description of what the bug is.

{"level":"warn","ts":"2020-04-27T07:03:30.243Z","caller":"clientv3/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"endpoint://client-9e7b5e2a-3047-4446-8f6d-cf8d9d62f02a/127.0.0.1:2379","attempt":0,"error":"rpc error: code = InvalidArgument desc = etcdserver: user name is empty"}
Error: etcdserver: user name is empty
command terminated with exit code 1

To Reproduce
Steps to reproduce the behavior:

  1. run helm install etcd bitnami/etcd -n compose --set auth.rbac.enabled=false
  2. run export POD_NAME=$(kubectl get pods --namespace compose -l "app.kubernetes.io/name=etcd,app.kubernetes.io/instance=etcd" -o jsonpath="{.items[0].metadata.name}")
  3. run kubectl exec -it $POD_NAME -n compose -- etcdctl put /message Hello

Expected behavior
A clear and concise description of what you expected to happen.
OK
Version of Helm and Kubernetes:

  • Output of helm version:
version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
  • Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.1", GitCommit:"7879fc12a63337efff607952a323df90cdc7a335", GitTreeState:"clean", BuildDate:"2020-04-08T17:38:50Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.1", GitCommit:"7879fc12a63337efff607952a323df90cdc7a335", GitTreeState:"clean", BuildDate:"2020-04-08T17:30:47Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

Additional context
Add any other context about the problem here.
works when using default namespace

@marcosbc
Copy link
Contributor

@Diluka I could not reproduce this issue by following your steps. Could you verify that you are using the latest available chart?

By the way, I noticed a few differences in the command in order to get this working, could you check if by any chance you made a typo copying the command?

-helm install etcd bitnami/etcd -n compose --set auth.rbac.enabled=false
+helm install --name etcd bitnami/etcd --namespace compose --set auth.rbac.enabled=false

After that it worked without issues:

$ kubectl exec -it $POD_NAME -n compose -- etcdctl put /message Hello
OK

@Diluka
Copy link
Author

Diluka commented Apr 28, 2020

+helm install --name etcd bitnami/etcd --namespace compose --set auth.rbac.enabled=false

Error: unknown flag: --name

helm version is 3

@marcosbc
Copy link
Contributor

You're right! I have just updated Helm to 3 to avoid similar situations in the future. 😅

Anyhow, I followed your steps again and it worked without issues for us. Is this an issue you can find reproducible? I.e. deploying in a new empty namespace, without an existing PVC, etc.

Also, could you confirm that you did not apply any other changes to the standalone chart apart from disabling auth.rbac.enabled?

@Diluka
Copy link
Author

Diluka commented Apr 28, 2020

root@ecs-6189:~# kubectl create namespace abc
namespace/abc created
root@ecs-6189:~# helm install etcd bitnami/etcd -n abc --set auth.rbac.enable=false
NAME: etcd
LAST DEPLOYED: Wed Apr 29 00:38:43 2020
NAMESPACE: abc
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **

etcd can be accessed via port 2379 on the following DNS name from within your cluster:

    etcd.abc.svc.cluster.local

To set a key run the following command:

    export POD_NAME=$(kubectl get pods --namespace abc -l "app.kubernetes.io/name=etcd,app.kubernetes.io/instance=etcd" -o jsonpath="{.items[0].metadata.name}")
    kubectl exec -it $POD_NAME -- etcdctl put /message Hello

To get a key run the following command:

    export POD_NAME=$(kubectl get pods --namespace abc -l "app.kubernetes.io/name=etcd,app.kubernetes.io/instance=etcd" -o jsonpath="{.items[0].metadata.name}")
    kubectl exec -it $POD_NAME -- etcdctl get /message

To connect to your etcd server from outside the cluster execute the following commands:

    kubectl port-forward --namespace abc svc/etcd 2379:2379 &
    echo "etcd URL: http://127.0.0.1:2379"

 * As rbac is enabled you should add the flag `--user root:$ETCD_ROOT_PASSWORD` to the etcdctl commands. Use the command below to export the password:

    export ETCD_ROOT_PASSWORD=$(kubectl get secret --namespace abc etcd -o jsonpath="{.data.etcd-root-password}" | base64 --decode)
root@ecs-6189:~# export POD_NAME=$(kubectl get pods --namespace abc -l "app.kubernetes.io/name=etcd,app.kubernetes.io/instance=etcd" -o jsonpath="{.items[0].metadata.name}")
root@ecs-6189:~# kubectl exec -it $POD_NAME -- etcdctl proot@ecs-6189:~# kubectl exec -it $POD_NAME -n abc -- etcdctl put /message Hello
{"level":"warn","ts":"2020-04-28T16:40:12.795Z","caller":"clientv3/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"endpoint://client-3d051b8d-5064-4f9b-8726-7e6ea8dee2fa/127.0.0.1:2379","attempt":0,"error":"rpc error: code = InvalidArgument desc = etcdserver: user name is empty"}
Error: etcdserver: user name is empty
command terminated with exit code 1

create a new namespace, and still failed

@marcosbc
Copy link
Contributor

marcosbc commented Apr 29, 2020

We were able to reproduce this issue in a Minikube environment. However, I'm unsure why this happens and need to continue investigating this.

Also, it looks like the NOTES are not taking into account the "auth.rbac.enable=false":

 * As rbac is enabled you should add the flag `--user root:$ETCD_ROOT_PASSWORD` to the etcdctl commands. Use the command below to export the password:

    export ETCD_ROOT_PASSWORD=$(kubectl get secret --namespace abc etcd -o jsonpath="{.data.etcd-root-password}" | base64 --decode)

We'll keep you posted.

@marcosbc marcosbc added the on-hold Issues or Pull Requests with this label will never be considered stale label May 12, 2020
@marcosbc
Copy link
Contributor

Hi @Diluka, after some troubleshooting I found the issue. First of all we should use auth.rbac.enabled=false (not auth.rbac.enable). With this change, new deployments will not set a root password.

Afterwards, it is possible that because of the misconfigured deployment, the etcd data was persisted so when you deployed the new statefulset it stopped working. To confirm that, you would see an entry like this in the pod logs:

==> Detected data from previous deployments...

To fix this issue, either deploy with a different name or in a different namespace, with the proper auth.rbac.enabled=false option, or delete the existing deployment including its persistent volume:

$ helm del -n abc etcd
$ kubectl delete pvc -n abc data-etcd-0

@marcosbc marcosbc removed the on-hold Issues or Pull Requests with this label will never be considered stale label May 14, 2020
@stale
Copy link

stale bot commented May 29, 2020

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.

@stale stale bot added the stale 15 days without activity label May 29, 2020
@stale
Copy link

stale bot commented Jun 3, 2020

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.

@simonbowen
Copy link

helm install etcd bitnami/etcd --set auth.rbac.enabled=false -n etcd

I am seeing this issue again with the above command.

NAME: etcd
LAST DEPLOYED: Tue May 24 12:26:02 2022
NAMESPACE: etcd
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: etcd
CHART VERSION: 8.2.2
APP VERSION: 3.5.4

** Please be patient while the chart is being deployed **

etcd can be accessed via port 2379 on the following DNS name from within your cluster:

    etcd.etcd.svc.cluster.local

To create a pod that you can use as a etcd client run the following command:

    kubectl run etcd-client --restart='Never' --image docker.io/bitnami/etcd:3.5.4-debian-10-r25 --env ROOT_PASSWORD=$(kubectl get secret --namespace etcd etcd -o jsonpath="{.data.etcd-root-password}" | base64 --decode) --env ETCDCTL_ENDPOINTS="etcd.etcd.svc.cluster.local:2379" --namespace etcd --command -- sleep infinity

Then, you can set/get a key using the commands below:

    kubectl exec --namespace etcd -it etcd-client -- bash
    etcdctl --user root:$ROOT_PASSWORD put /message Hello
    etcdctl --user root:$ROOT_PASSWORD get /message

To connect to your etcd server from outside the cluster execute the following commands:

    kubectl port-forward --namespace etcd svc/etcd 2379:2379 &
    echo "etcd URL: http://127.0.0.1:2379"

 * As rbac is enabled you should add the flag `--user root:$ETCD_ROOT_PASSWORD` to the etcdctl commands. Use the command below to export the password:

    export ETCD_ROOT_PASSWORD=$(kubectl get secret --namespace etcd etcd -o jsonpath="{.data.etcd-root-password}" | base64 --decode)

@carrodher
Copy link
Member

Can you please create a new issue specifying your concrete use case and fill the issue template? With that, we should have all the info available

@nicovak
Copy link

nicovak commented May 31, 2022

@simonbowen It should be auth.rbac.create not auth.rbac.enabled since c3f6f9a

Anyway, I still have the same issue, I'll try fixing It or disabling probes

@simonbowen
Copy link

@nicovak If I remember correctly I tried it both ways and neither worked.

@nicovak
Copy link

nicovak commented May 31, 2022

@simonbowen I saw the ternary condition in helm statefulset template, you are right.
I confirm It's running by disabling probes

helm install etcd-dns bitnami/etcd --set auth.rbac.create=false,readinessProbe.enabled=false,livenessProbe.enabled=false,startupProbe.enabled=false --namespace kube-system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale 15 days without activity
Projects
None yet
Development

No branches or pull requests

5 participants