Cyscale Kubernetes Agent 是一款与 Cyscale Platform 集成的 Kubernetes 代理组件,旨在通过收集 Kubernetes 集群的资源配置、运行时数据及安全相关信息,为 Cyscale Platform 提供数据输入,从而实现对集群安全状态的持续监控、风险识别与合规性评估。
kubectl 命令行工具,且具备集群管理员权限(用于部署代理)。创建代理配置文件(如 cyscale-agent-deployment.yaml),示例如下(根据实际环境调整参数):
yamlapiVersion: apps/v1 kind: Deployment metadata: name: cyscale-agent namespace: cyscale-agent labels: app: cyscale-agent spec: replicas: 1 selector: matchLabels: app: cyscale-agent template: metadata: labels: app: cyscale-agent spec: containers: - name: cyscale-agent image: cyscale/k8s-agent:latest # 替换为实际镜像标签 imagePullPolicy: Always env: - name: CYSCALE_API_KEY value: "your-cyscale-api-key" # 替换为 Cyscale API 密钥 - name: CLUSTER_NAME value: "your-cluster-name" # 自定义集群名称(用于平台识别) - name: LOG_LEVEL value: "info" # 日志级别:debug/info/warn/error resources: limits: cpu: "500m" memory: "512Mi" requests: cpu: "200m" memory: "256Mi"
创建命名空间(如 cyscale-agent):
bashkubectl create namespace cyscale-agent
应用部署配置:
bashkubectl apply -f cyscale-agent-deployment.yaml -n cyscale-agent
检查 Pod 运行状态:
bashkubectl get pods -n cyscale-agent
预期输出:cyscale-agent-xxxxxxxxx-xxxxx 状态为 Running。
查看代理日志(确认数据上报正常):
bashkubectl logs -f <pod-name> -n cyscale-agent
以下为生产环境推荐的 Deployment 配置(包含资源限制、健康检查及自动重启策略):
yamlapiVersion: apps/v1 kind: Deployment metadata: name: cyscale-agent namespace: cyscale-agent labels: app: cyscale-agent spec: replicas: 1 selector: matchLabels: app: cyscale-agent strategy: rollingUpdate: max***: 0 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: cyscale-agent spec: containers: - name: cyscale-agent image: cyscale/k8s-agent:v1.2.0 # 指定具体版本,避免自动升级风险 imagePullPolicy: IfNotPresent env: - name: CYSCALE_API_KEY valueFrom: secretKeyRef: name: cyscale-secrets key: api-key # 推荐通过 Secret 管理敏感信息 - name: CLUSTER_NAME value: "production-cluster-01" - name: LOG_LEVEL value: "info" - name: SCAN_INTERVAL value: "300" # 扫描间隔(秒),默认 300 resources: limits: cpu: "1000m" memory: "1Gi" requests: cpu: "500m" memory: "512Mi" livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 30 periodSeconds: 10 readinessProbe: httpGet: path: /ready port: 8080 initialDelaySeconds: 5 periodSeconds: 5 securityContext: readOnlyRootFilesystem: true # 增强容器安全性 runAsNonRoot: true runAsUser: 1000 restartPolicy: Always
若需在非 K8s 环境中运行代理(仅用于测试),可通过 docker run 命令启动容器:
bashdocker run -d \ --name cyscale-agent \ -e CYSCALE_API_KEY="your-api-key" \ -e CLUSTER_NAME="test-cluster" \ -e KUBECONFIG=/kubeconfig \ -v /path/to/local/kubeconfig:/kubeconfig \ # 挂载本地 kubeconfig 以访问集群 cyscale/k8s-agent:latest
| 参数名 | 描述 | 必填 | 默认值 | 示例值 |
|---|---|---|---|---|
CYSCALE_API_KEY | Cyscale Platform API 密钥 | 是 | - | cs-abc123def456... |
CLUSTER_NAME | 集群名称(用于平台识别) | 是 | - | production-cluster |
LOG_LEVEL | 日志级别 | 否 | info | debug/warn/error |
SCAN_INTERVAL | 资源扫描与数据上报间隔(秒) | 否 | 300 | 60(高频扫描) |
CYSCALE_API_ENDPOINT | Cyscale API 服务地址(私有化部署用) | 否 | 公网地址 | [***] |
PROXY_URL | 代理服务器地址(如需要网络代理) | 否 | - | [***] |
根据集群规模调整资源请求与限制:
200m-500m,内存 256Mi-512Mi500m-1000m,内存 512Mi-1Gi1000m-2000m,内存 1Gi-2Gi更新部署文件中的镜像标签(如 v1.2.0 升级至 v1.3.0):
yamlimage: cyscale/k8s-agent:v1.3.0
应用更新:
bashkubectl apply -f cyscale-agent-deployment.yaml -n cyscale-agent
bashkubectl delete deployment cyscale-agent -n cyscale-agent kubectl delete namespace cyscale-agent
来自真实用户的反馈,见证轩辕镜像的优质服务
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像加速服务
在 Docker Desktop 配置镜像加速
Docker Compose 项目配置加速
Kubernetes 集群配置 Containerd
在宝塔面板一键配置镜像加速
Synology 群晖 NAS 配置加速
飞牛 fnOS 系统配置镜像加速
极空间 NAS 系统配置加速服务
爱快 iKuai 路由系统配置加速
绿联 NAS 系统配置镜像加速
QNAP 威联通 NAS 配置加速
Podman 容器引擎配置加速
HPC 科学计算容器配置加速
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名加速
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429