当前位置:网站首页>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
边栏推荐
- npm warn config global `--global`, `--local` are deprecated. use `--location=global` instead.
- Solve a series of problems in using Bert encoder
- 全志F1C100S/F1C200S学习笔记(13)——LVGL移植
- Dynamic programming -- knapsack problem
- Tensor, numpy, PIL format conversion and image display
- Optimize Huawei ECs to use key login
- (heavy chain dissection) Magic Tree
- C language implements memcpy and memmove
- 扁平样式反馈表单页面
- 基金开户网上办理是否安全?谁给解答一下
猜你喜欢

4. Find the median of two positive arrays

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

Tensor, numpy, PIL format conversion and image display

Wacom firmware update error 123, digital board driver cannot be updated

The win11 installation system prompts that VirtualBox is incompatible and needs to uninstall the solution of virtual, but the uninstall list cannot find the solution of virtual

手工测试如何转向自动化测试?字节5年自动化经验浅谈一下...

ArcGIS uses DEM data to delineate the specific steps and processes of catchment area

Optimisation du serveur Cloud Huawei avec connexion clé

Flat style feedback form page
![Looking for peak [Abstract dichotomy exercise]](/img/99/122e79784f0f07120680d2cbcf89da.png)
Looking for peak [Abstract dichotomy exercise]
随机推荐
spotlight灯箱js插件全屏放大图片
Which is a good fixed asset management system? What are the fixed asset management platforms?
Pacific Atlantic current problem
Summary of JS data type judgment methods
Using JS to parse and execute XSS automatically
Due to resource constraints, the namenode fails to start with an error unable to create new native thread
Fabric. JS basic brush
Can bus quick understanding
JS texture style pie chart plug-in
webstrom ERROR in [eslint] ESLint is not a constructor
Quanzhi f1c100s/f1c200s learning notes (13) -- lvgl transplantation
CAN总线快速了解
FFmpeg 1 - 概览/安装
Find the maximum area of the island -- depth first search (staining method)
Wacom firmware update error 123, digital board driver cannot be updated
AI acceleration gesture recognition experience based on efr32mg24
【测试平台开发】十七、接口编辑页面实现下拉级联选择,绑定接口所属模块...
力扣142题:环形链表2
【小程序自动化Minium】一、框架介绍和环境搭建
C语言项目实战:24点游戏计算器(基于结构体、指针、函数、数组、循环等知识点)