当前位置:网站首页>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 -
分享、点赞和在看
支持我们分享更多好文章,谢谢!
点个在看集群永保稳定
边栏推荐
- Case ---- how efficient is the buffer stream compared with the ordinary input stream and output stream?
- What does "TTL" mean in domain name resolution?
- [C language] in depth understanding of pointers and arrays (phase I)
- Dry goods | training AI model can't find data? Collect 20 selected open source communities!
- HTX00001_ Keil51 bug encountered in serial port parsing
- Some interview questions collected
- Solve the problem of invalid modification of QT 5 interface. Solve the problem of invalid modification of qtdesigner
- Detailed explanation of arm instruction CMP
- JVM tuning summary -xms -xmx -xmn -xss
- 在C# WinForms应用程序中安装,配置和使用MetroFramework
猜你喜欢

Evolution of coupon architecture under C2B mode

Insight into mobile application operation growth in 2022 white paper: the way to "break the situation" in the era of diminishing traffic dividends
![[unity3d] ugui callback function](/img/6f/312e7f2cf76fa932e66c5ba0737219.png)
[unity3d] ugui callback function

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

C control open source library: download of metroframework

C#开源控件MetroFramework Demo项目下载和运行

【transformer】DeiT

容器内组播

Do you know the same period last year in powerbi

The LAF protocol elephant of defi 2.0 may be one of the few profit-making means in your bear market
随机推荐
What does "TTL" mean in domain name resolution?
C language -c51 compilation warning "* * * warning l1: unresolved external symbol" and extern
[jailhouse article] base architectures for virtual physical computing (2018)
Solve the problem of invalid modification of QT 5 interface. Solve the problem of invalid modification of qtdesigner
Download and run the C open source control metroframework demo project
Some interview questions collected
A little consideration of strategic mode
Builder pattern
EXCEL
Keilc51 usage details (III)
C#读取倍福Beckhoff变量
labelme标注不同物体显示不同颜色以及批量转换
Temperature table lookup and calculation formula
MySQL queries the table name under the current database
Keil uvisin5 code auto completion or code Association
Use abp Zero builds a third-party login module (III): web side development
Vbs script COM object extension and use (3)
How programmers write bugs
Labelme labels different objects, displays different colors and batch conversion
四、MFC工具栏、运行时类信息机制、运行时创建机制