twingate/kubernetes-operatorTwingate Kubernetes Controller 是一个自定义控制器,旨在 Kubernetes 环境中自动化管理 Twingate 资源。该控制器提供 Kubernetes 集群与 Twingate 零信任网络(Twingate Zero Trust Network)的无缝集成,实现对 Twingate 资源的自动化配置、部署与生命周期管理。
kubectl)。docker run 运行(注:该控制器通常需在 Kubernetes 集群内运行,以下为简化示例,实际部署建议通过 Kubernetes 资源配置)
bashdocker run -d \ --name twingate-k8s-controller \ -e TWINGATE_API_KEY=<your-twingate-api-key> \ -e TWINGATE_TENANT=<your-twingate-tenant> \ -e KUBECONFIG=/kube/config \ -v /path/to/kubeconfig:/kube/config \ twingate/kubernetes-operator:latest
yamlversion: '3.8' services: twingate-controller: image: twingate/kubernetes-operator:latest container_name: twingate-k8s-controller environment: - TWINGATE_API_KEY=<your-twingate-api-key> # Twingate API 密钥(必填) - TWINGATE_TENANT=<your-twingate-tenant> # Twingate 租户 ID(必填) - KUBECONFIG=/kube/config # Kubernetes 配置文件路径 - LOG_LEVEL=info # 日志级别(可选,默认 info) volumes: - /path/to/local/kubeconfig:/kube/config # 挂载本地 Kubernetes 配置文件 restart: unless-stopped
由于该控制器为 Kubernetes 原生组件,推荐通过 Kubernetes 资源清单部署(如 Deployment、ServiceAccount 等)。以下为核心配置示例:
yamlapiVersion: v1 kind: ServiceAccount metadata: name: twingate-controller namespace: twingate-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: twingate-controller-role rules: - apiGroups: [""] resources: ["pods", "services"] verbs: ["get", "list", "watch"] # 按需调整权限范围 # 其他必要权限(如管理 Twingate CRD 等) --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: twingate-controller-binding subjects: - kind: ServiceAccount name: twingate-controller namespace: twingate-system roleRef: kind: ClusterRole name: twingate-controller-role apiGroup: rbac.authorization.k8s.io
yamlapiVersion: apps/v1 kind: Deployment metadata: name: twingate-controller namespace: twingate-system spec: replicas: 1 selector: matchLabels: app: twingate-controller template: metadata: labels: app: twingate-controller spec: serviceAccountName: twingate-controller containers: - name: controller image: twingate/kubernetes-operator:latest env: - name: TWINGATE_API_KEY valueFrom: secretKeyRef: name: twingate-secrets key: api-key - name: TWINGATE_TENANT valueFrom: secretKeyRef: name: twingate-secrets key: tenant - name: LOG_LEVEL value: "info" resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 256Mi
| 变量名 | 描述 | 是否必填 | 默认值 |
|---|---|---|---|
TWINGATE_API_KEY | Twingate API 访问密钥 | 是 | - |
TWINGATE_TENANT | Twingate 租户 ID(如 your-tenant.twingate.com 中的 your-tenant) | 是 | - |
LOG_LEVEL | 日志级别(支持 debug/info/warn/error) | 否 | info |
KUBECONFIG | Kubernetes 配置文件路径(容器内路径) | 否 | 自动使用集群内配置(InClusterConfig) |

manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务