当前位置:网站首页>ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
2022-07-25 06:34:00 【dotNET跨平台】
命令行登录
参考:argocd 登录登出[1]
登录:
echo y | argocd login argocd-server.argocd.svc.cluster.local --password '[email protected]' --username admin登出:
argocd logout argocd-server.argocd.svc.cluster.local创建用户、授权
创建用户
参考:用户管理[2]
在 argocd/argocd-cm 中增加一个 gitops 用户,有生成 apiKey 和 login 权限。
apiVersion: v1
data:
accounts.gitops: apiKey, login
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
name: argocd-cm
namespace: argocd修改后,会热加载,无需重启任何服务。
用 admin 用户登录后,修改 gitops 的密码为 [email protected](注意 current-password 是当前登录用户的密码,如果用 admin 登录的,就是 admin 的密码)
argocd account update-password \
--account gitops \
--current-password '[email protected]' \
--new-password '[email protected]'此时可以用命令行登录:
echo y | argocd login argocd-server.argocd.svc.cluster.local --password '[email protected]' --username gitops此用户登录进去看不到 admin 建的任何资源(app、project、仓库、cluster 等)。给 gitops 用户生成 token:(这样生成的 token 从不过期,可以加--expires-in 参数设置过期时长)
# argocd account generate-token --account gitops
xxxx之后就需要 login 了,需要指定--server 和--insecure
argocd app list --auth-token xxx --server argocd-server.argocd.svc.cluster.local --insecure但使用 token 的方式,每次执行命令行都需要加参数,较为复杂。直接 login 后操作更为简单。
权限
参考:Rbac 权限控制[3]
资源和动作有下面这些:
Resources: clusters, projects, applications, repositories, certificates, accounts, gpgkeys, logs, exec Actions: get, create, update, delete, sync, override, action/<group/kind/action-name>
在 argocd-rbac-cm Configmaps 中给增加以下 policy.csv 就可以看到 admin 创建的 app、仓库等信息了:
data:
policy.csv: |
p, role:gitops, applications, get, *, allow
p, role:gitops, applications, create, *, allow
p, role:gitops, applications, update, *, allow
p, role:gitops, applications, sync, *, allow
p, role:gitops, applications, override, *, allow
p, role:gitops, repositories, get, *, allow
p, role:gitops, repositories, create, *, allow
p, role:gitops, repositories, update, *, allow
p, role:gitops, projects, create, *, allow
p, role:gitops, projects, get, *, allow
p, role:gitops, clusters, get, *, allow
p, role:gitops, clusters, list, *, allow
g, gitops, role:gitops
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: argocd-rbac-cm
app.kubernetes.io/part-of: argocd
name: argocd-rbac-cm
namespace: argocd注意:必须增加 g, gitops, role:gitops将 gitops 用户加到 gitops 这个 role 中。
触发同步 sync
echo y | argocd login argocd-server.argocd.svc.cluster.local --password '[email protected]' --username gitops
argocd app sync apps-by-top-app参考资料
[1]
argocd 登录登出: https://argo-cd.readthedocs.io/en/stable/user-guide/commands/argocd_login/
[2]用户管理: https://argo-cd.readthedocs.io/en/stable/operator-manual/user-management/
[3]Rbac 权限控制: https://argo-cd.readthedocs.io/en/stable/operator-manual/rbac/
- END -
分享、点赞和在看
支持我们分享更多好文章,谢谢!
点个在看集群永保稳定
边栏推荐
- C control open source library: download of metroframework
- C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern
- Req.body in node.express is always undefind
- The most comprehensive multi-threaded application tutorial - summary in detail
- Cout format output common functions and flags summary
- 机器学习两周学习成果
- [C language] program environment and preprocessing
- Introduction to bridging mode and sharing mode
- Seekbar属性参考
- VBS common built-in functions (2)
猜你喜欢

C control open source library: download of metroframework

Keil uvisin5 code auto completion or code Association

Recycleview realizes horizontal sliding of overlapping items

Install, configure, and use the metroframework in the C WinForms application

VSCode 如何开启多个终端?如何横向显示?
![[datawhale202207] reinforcement learning: strategy gradient and near end strategy optimization](/img/4e/aabc603e47977503a4bcc5d07b4c61.png)
[datawhale202207] reinforcement learning: strategy gradient and near end strategy optimization

DOM event type

Evolution of coupon architecture under C2B mode

C # --metroframework framework calls the metromodernui library and uses it in the toolbar

【Jailhouse 文章】Base Architectures for virtual-physical computing(2018)
随机推荐
Observer mode
JZ7 rebuild binary tree
【datawhale202207】强化学习:强化学习基础
Define usage method and template
Restrict Su command and sudo mechanism to promote nmap and console command netstat
The code of Keil and Si compiler is not aligned??
C # read Beckhoff variable
Some common interview questions about IO stream and string
杜教筛
“font/woff“ and “font/woff2“ in file “mime.types“
Mysql database backup and recovery
【剑指Offer】模拟实现atoi
How programmers write bugs
【transformer】DeiT
DOM events
Builder pattern
[cann training camp] play with the one-stop plan of cann target detection and recognition - learning notes 1 (initial experience)
C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern
Common mode inductance has been heard many times, but what principle do you really understand?
Machine learning keras fitting sine function