argocd 的默认密码是什么?

What is the default password of argocd?

我已经使用以下命令在 aks 上安装了 argocd:

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/master/manifests/install.yaml

那我改成负载均衡服务

kubectl edit svc argocd-server -n argocd

现在,当我连接到 argocd web ui 时,我无法使用以下凭据连接。

user: admin password: argocd-server-9b77b6575-ts54n

如文档中所述,密码是从以下命令获得的。

kubectl get po -n argocd
NAME                                 READY   STATUS    RESTARTS   AGE
argocd-application-controller-0      1/1     Running   0          21m
argocd-dex-server-5559bc9679-5mj4v   1/1     Running   1          21m
argocd-redis-74d8c6db65-sxbnt        1/1     Running   0          21m
argocd-repo-server-6866f58df-m59sr   1/1     Running   0          21m
argocd-server-9b77b6575-ts54n        1/1     Running   0          21m

请建议我如何登录,默认凭据是什么。

我什至尝试使用此命令重置它。

kubectl -n argocd patch secret argocd-secret -p '{"stringData": {
    "admin.password": "a$Ix3Pd7mywOwVWOK8eSSY0uo60V6Vf6DtZljGuLwGRHQNnWNBbOLhW",
    "admin.passwordMtime": "'$(date +%FT%T%Z)'"
  }}'

但是出现这个错误:

Error from server (BadRequest): invalid character 's' looking for beginning of object key string
Error from server (NotFound): secrets "2021-07-08T12:59:15IST" not found
Error from server (NotFound): secrets "\n  }}" not found

您通过键入获得密码

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

使用 kubectl get pods 你会得到 pod 名称,而不是密码。 应用程序将密码保存到 Kubernetes Secret 中是很常见的。秘密值是 base64 编码的,因此要更新秘密,它必须是有效的 base64 echo newpassword | base64。不过请记住,更新密码不会更改应用程序密码。

用户:admin

要获取密码,请键入以下命令:

kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d

此问题的解决方案(本地 ArgoCD 设置)

  1. 补丁秘密以更新密码。
kubectl -n argocd patch secret argocd-secret  -p '{"data": {"admin.password": null, "admin.passwordMtime": null}}'

这会将密码重置为 pod 名称。

  1. 重新启动 api-server pod。通过将 Pod 副本缩放为零然后再缩放回一来执行此操作。
kubectl -n argocd scale deployment argocd-server --replicas=0

once scaled-down, make sure to scale back up and wait a few minutes before

kubectl -n argocd scale deployment argocd-server --replicas=1
  1. ArgoCD 的新密码将是您的 api-server pod 名称,名称末尾带有数字(kubectl -n argocd get po >> 查找 pod 名称)

即登录:

  • 用户:admin
  • 通过:argocd-server-6cdb9b4b84-jvl58

应该可以。

访问https://github.com/argoproj/argo-cd/blob/master/docs/faq.md

#bcrypt(password)=a$rRyBsGSHK6.uc8fntPwVIuLVHgsAhAX7TcdrqW/RADU0uh7CaChLa
kubectl -n argocd patch secret argocd-secret \
  -p '{"stringData": {
    "admin.password": "a$rRyBsGSHK6.uc8fntPwVIuLVHgsAhAX7TcdrqW/RADU0uh7CaChLa",
    "admin.passwordMtime": "'$(date +%FT%T%Z)'"
  }}

您的新密码是“password”