当前位置:网站首页>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 -
分享、点赞和在看
支持我们分享更多好文章,谢谢!
点个在看集群永保稳定
边栏推荐
- [Luogu p6629] string (runs) (tree array)
- Typedef usage and template
- Quick sort code implementation
- DOM events
- In container multicast
- 长安链Solidity智能合约调用原理分析
- C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern
- Android interview question: why do activities rebuild ViewModel and still exist—— Jetpack series (3)
- 【C】 Program environment and pretreatment
- Using JS to realize the linkage effect of form form's secondary menu
猜你喜欢

【datawhale202207】强化学习:强化学习基础

Do you know the same period last year in powerbi

How does vscode enable multiple terminals? How to display horizontally?

A little consideration of strategic mode

Use abp Zero builds a third-party login module (III): web side development

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

What determines the "personality" of AI robots?

Special episode of Goddess Festival | exclusive interview with Chinese AI goddess Zhang Qingqing's transformation from a female learning tyrant to a female entrepreneur

Bug notes

Create a new STM32 project and configure it - based on registers
随机推荐
DOM event type
共模电感听过很多次,但是什么原理你们真的懂吗?
机器人工程-教学品质-如何判定
Koa2 learning
Memory memory operation function
Recycleview realizes horizontal sliding of overlapping items
When the graduation season comes, are you ready? What are we going to do
A scene application of 2D animation
Case ---- how efficient is the buffer stream compared with the ordinary input stream and output stream?
HTX00001_ Keil51 bug encountered in serial port parsing
[C language] in depth understanding of pointers and arrays (phase I)
Mysql database backup and recovery
Common mode inductance has been heard many times, but what principle do you really understand?
JTAG debugging source level debugging of arm bare board debugging
Can communication test based on STM32: turn the globe
DOM events
在C# WinForms应用程序中安装,配置和使用MetroFramework
[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
mysql数据库备份和恢复