Khai báo kho
| Trường | Ghi chú |
|---|---|
| API server | https://k8s.congty.local:6443 (phải trong allowed_hosts của agent) |
| Xác thực | Token của ServiceAccount, hoặc kubeconfig trên máy chạy agent |
| CA của API server | File CA hoặc nội dung PEM |
Nơi cài
| Trường | Ghi chú |
|---|---|
| Namespace | web |
| Tên Secret | Để trống: <tên chứng chỉ>-tls |
Agent tạo/cập nhật Secret kubernetes.io/tls (tls.crt gồm chuỗi, tls.key) và ghi annotation certman.mettacert.com/updated. Ingress controller (nginx, Traefik, HAProxy) tự tải lại khi Secret đổi.
RBAC tối thiểu
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata: { name: certman-agent, namespace: web }
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "create", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata: { name: certman-agent, namespace: web }
subjects: [{ kind: ServiceAccount, name: certman-agent, namespace: web }]
roleRef: { kind: Role, name: certman-agent, apiGroup: rbac.authorization.k8s.io }
Dùng Role trong đúng namespace, không dùng ClusterRole. Cluster đã có cert-manager thì vẫn có thể dùng Metta cho chứng chỉ thương mại/CA nội bộ mà cert-manager không hỗ trợ.