当前位置:网站首页>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 -
分享、点赞和在看
支持我们分享更多好文章,谢谢!
点个在看集群永保稳定
边栏推荐
- What does PK, NN, Qu, B, UN, ZF, AI, G mean when creating tables in MySQL
- [sword finger offer] analog implementation ATOI
- Shell script realizes the scheduled backup of MySQL database on two computers
- Seekbar属性参考
- Create a new STM32 project and configure it - based on registers
- The code spell checker plug-in avoids some specific vocabulary errors "XXX": unknown word.cspell
- 【transformer】DeiT
- 51 timer initial value calculation
- Review of some classic exercises of arrays
- Case ---- how efficient is the buffer stream compared with the ordinary input stream and output stream?
猜你喜欢

Data too long for column 'data' at row 1 and the garbled code caused by setting to longblob are solved. node-mysql

Create a new STM32 project and configure it - based on registers

100 GIS practical application cases (seventeen) - making 3D map based on DEM

Can communication test based on STM32: turn the globe

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

The code spell checker plug-in avoids some specific vocabulary errors "XXX": unknown word.cspell

2022 "strong country Cup" preliminary WP (with script and detailed process)

Quick sort code implementation

Insight into mobile application operation growth in 2022 white paper: the way to "break the situation" in the era of diminishing traffic dividends

Do you know the same period last year in powerbi
随机推荐
Prevention strategy of Chang'an chain Shuanghua transaction
RecycleView实现item重叠水平滑动
四、MFC工具栏、运行时类信息机制、运行时创建机制
【datawhale202207】强化学习:强化学习基础
In container multicast
Pic16f877xa instruction system (assembly language)
Download and run the C open source control metroframework demo project
[C language] in depth understanding of pointers and arrays (phase I)
What does "TTL" mean in domain name resolution?
[jailhouse article] base architectures for virtual physical computing (2018)
Learning notes: detailed use of 12864 LCD module
Bug notes
Seekbar attribute reference
DOM events
JS gets the text selected by the mouse and is in the selected state
Machine learning keras fitting sine function
JTAG debugging source level debugging of arm bare board debugging
Standard C language 6
机器学习 Keras拟合正弦函数
C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern