当前位置:网站首页>ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
2022-07-23 09:13:00 【进击云原生】
命令行登录
参考:argocd 登录登出
登录:
echo y | argocd login argocd-server.argocd.svc.cluster.local --password '[email protected]' --username admin
登出:
argocd logout argocd-server.argocd.svc.cluster.local
创建用户、授权
创建用户
参考:
用户管理
在 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 权限控制
资源和动作有下面这些:
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
边栏推荐
- 基金开户网上办理是否安全?谁给解答一下
- Several hole filling methods of point cloud (mesh) (1)
- How can manual testing turn to automated testing? Byte 5 years of automation experience talk about
- Cool code rain dynamic background registration page
- About flex layout justify content: the last solution to the misalignment of space around and why it is solved like this is a discussion
- 10年软件测试工程师经验,很茫然....
- JS texture style pie chart plug-in
- JS software unloading prompt expression changes with the mouse JS special effect
- C language implements memcpy and memmove
- 【测试平台开发】23. 接口断言功能-保存接口断言和编辑回显
猜你喜欢

Quick introduction to PKI system

Can bus quick understanding

LZ77文件压缩

JS texture style pie chart plug-in

Surrounded Regions

Several hole filling methods of point cloud (mesh) (1)

固定资产管理系统哪家好?固定资产管理平台有哪些?

Cool code rain dynamic background registration page

npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead.

Optimize Huawei ECs to use key login
随机推荐
Canvas 从入门到劝朋友放弃(图解版)
JS texture style pie chart plug-in
spotlight灯箱js插件全屏放大图片
对象使用过程中背后调用了哪些方法
websocket通用化封装设计与实现
手机股票开户风险性大吗,安全吗?
ValidationError: Invalid options object. Dev Server has been initialized using an options object th
Tensor, numpy, PIL format conversion and image display
[pyqt5 installation and use]
4. Find the median of two positive arrays
因为资源限制,导致namenode启动失败,报错unable to create new native thread
基于EFR32MG24的AI 加速度姿势识别体验
【C語言】猜數字小遊戲+關機小程序
第三章 复杂一点的查询
Is it risky and safe to open an account for stock speculation?
Cool code rain dynamic background registration page
Sword finger offer 46. translate numbers into strings
ArcGIS uses DEM data to delineate the specific steps and processes of catchment area
【测试平台开发】21. 完成发送接口请求显示响应头信息
Sword finger offer19 regular expression