
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
在集群中部署内部服务并通过Ingress暴露是常见场景,这些服务通常通过Dex进行认证,但添加新的staticClients需手动操作。本工具旨在自动配置https://github.com/dexidp/dex%E7%9A%84%60staticClient%60%E6%9D%A1%E7%9B%AE%EF%BC%8C%E9%80%9A%E8%BF%87%E5%9C%A8%E9%9B%86%E7%BE%A4%E5%86%85%E8%BF%90%E8%A1%8C%EF%BC%8C%E7%9B%91%E6%8E%A7Ingress%E3%80%81ConfigMap%E6%88%96Secret%E8%B5%84%E6%BA%90%E7%9A%84%E6%B3%A8%E8%A7%A3%EF%BC%8C%E5%B9%B6%E9%80%9A%E8%BF%87gRPC%E5%AF%B9Dex%E8%BF%9B%E8%A1%8C%E4%BF%AE%E6%94%B9%E3%80%82
默认仅监控Ingress资源(最常见场景),可选择监控ConfigMap和/或Secret资源。使用Secret存储staticClient的client-secret更为安全,尤其结合https://github.com/bitnami-labs/sealed-secrets%E7%AD%89%E5%B7%A5%E5%85%B7%E6%97%B6%E3%80%82
staticClient条目mintel.com/dex-k8s-ingress-watcher: enabled)筛选,避免无差别监控$HOME/.kube/config)运行bashmake build
集群内外运行模式
$HOME/.kube/config配置运行示例
默认仅Ingress监控
bash./bin/dex-k8s-ingress-watcher serve --dex-grpc-address localhost:5557
带ConfigMap和Secret监控
bash./bin/dex-k8s-ingress-watcher serve --dex-grpc-address localhost:5557 --ingress-controller --configmap-controller --secret-controller
禁用Ingress监控
bash./bin/dex-k8s-ingress-watcher serve --dex-grpc-address localhost:5557 --no-ingress-controller --configmap-controller --secret-controller
https://github.com/mintel/dex-k8s-ingress-watcher/blob/master/hack/deployment/clusterrole.yaml%E4%B8%AD%E7%9A%84ClusterRole%E9%85%8D%E7%BD%AE%E6%94%AF%E6%8C%81%E6%89%80%E6%9C%89%E6%8E%A7%E5%88%B6%E5%99%A8%EF%BC%88Ingress%E3%80%81ConfigMap%E5%92%8CSecret%EF%BC%89%E3%80%82%E5%BB%BA%E8%AE%AE%E7%A7%BB%E9%99%A4%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E6%8E%A7%E5%88%B6%E5%99%A8%E4%BB%A5%E9%99%90%E5%88%B6%E8%B5%84%E6%BA%90%E8%AE%BF%E9%97%AE%E6%9D%83%E9%99%90%EF%BC%8C%E5%B0%A4%E5%85%B6%E6%98%AFSecret%E8%B5%84%E6%BA%90%E3%80%82
mintel.com/dex-k8s-ingress-watcher: enabled的资源,当存在指定注解时创建/删除Dex客户端(此标签用于减少监控范围)所有资源类型使用相同的注解,用于定义staticClient属性:
| 注解键 | 说明 | 是否必填 |
|---|---|---|
mintel.com/dex-k8s-ingress-watcher-client-id | 客户端ID | 是 |
mintel.com/dex-k8s-ingress-watcher-client-name | 客户端名称(默认与client-id相同) | 否 |
mintel.com/dex-k8s-ingress-watcher-secret | 客户端密钥 | 是 |
mintel.com/dex-k8s-ingress-watcher-redirect-uri | 重定向URI(多个URI用逗号分隔) | 是 |
注解示例(Ingress)
yamlapiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: mintel.com/dex-k8s-ingress-watcher-client-id: my-app mintel.com/dex-k8s-ingress-watcher-client-name: My Application mintel.com/dex-k8s-ingress-watcher-secret: a-secret mintel.com/dex-k8s-ingress-watcher-redirect-uri: https://myapp.example.com/oauth/callback,https://myapp.example.com/oauth/callbackV2
生成的Dex staticClient
yamlstaticClients: - id: my-app name: My Application secret: a-secret redirectURIs: - 'https://myapp.example.com/oauth/callback' - 'https://myapp.example.com/oauth/callbackV2'
示例清单位于https://github.com/mintel/dex-k8s-ingress-watcher/blob/master/hack/deployment/%EF%BC%8C**%E6%B3%A8%E6%84%8F**%EF%BC%9A
推荐将本工具作为Dex的sidecar运行,通过localhost进行gRPC通信。假设Dex运行在127.0.0.1,gRPC端口为5557。
Sidecar配置示例
yaml- name: dex-k8s-ingress-watcher command: - /app/bin/dex-k8s-ingress-watcher - serve - --incluster - --ingress-controller - --configmap-controller - --secret-controller - --dex-grpc-address - 127.0.0.1:5557 image: mintel/dex-k8s-ingress-watcher:latest imagePullPolicy: IfNotPresent resources: limits: cpu: 50m memory: 64Mi requests: cpu: 20m memory: 32Mi
通过Dex认证的应用通常可运行OpenID代理服务作为sidecar,例如https://github.com/gambol99/keycloak-proxy%E3%80%82
yaml- name: proxy image: quay.io/gambol99/keycloak-proxy:v2.1.1 imagePullPolicy: Always resources: limits: cpu: 100m memory: 128Mi requests: cpu: 50m memory: 64Mi args: - --verbose=true - --listen=:3000 - --upstream-url=http://0.0.0.0:8000 - --discovery-url=https://dex.example.com/.well-known/openid-configuration - --client-id=my-app - --skip-upstream-tls-verify - --redirection-url=https://myapp.example.com - --secure-cookie=false - --client-secret=a-secret - --enable-authorization-header - --skip-openid-provider-tls-verify - --add-claims=groups - --scopes=groups - --resources=uri=/*
关键配置说明
3000)upstream-url指向需要保护的应用(同一主机,不同端口)client-secret必须与mintel.com/dex-k8s-ingress-watcher-secret注解值匹配client-id必须与mintel.com/dex-k8s-ingress-watcher-client-id注解值匹配resources=uri选项限制访问,可结合Dex返回的groups进行权限控制您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。


来自真实用户的反馈,见证轩辕镜像的优质服务