一键导入
use-kube-dc-cli
Use the kube-dc CLI for authentication, context switching, and namespace management. Covers login, use, ns, config, and kubectl integration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use the kube-dc CLI for authentication, context switching, and namespace management. Covers login, use, ns, config, and kubectl integration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Deploy a virtual machine in a Kube-DC project with SSH, cloud-init, optional external access, and an optional gated Dedicated GPU VM profile. Use for ordinary VMs and whole-device GPU VMs that require platform preflight and non-migration safeguards.
Deploy a containerized application to a Kube-DC project with optional database, service exposure, persistent storage, and gated Shared GPU acceleration. Use for Helm or raw CPU workloads and for Shared GPU requests that must go through the platform preview/create API.
Manage Kube-DC storage resources — create S3 buckets (ObjectBucketClaim), DataVolumes for VMs, and PersistentVolumeClaims for containers.
Manage Kube-DC managed Kubernetes clusters — scale worker pools, upgrade versions, access kubeconfig, and monitor status. Covers day-2 operations via kubectl patch.
Create and manage Kube-DC DatabaseCredentialPolicy (DBCP) resources — project-scoped CRDs that rotate database passwords on a tenant-chosen schedule and project them into a Kubernetes Secret. Works against KdcDatabase (PostgreSQL via CNPG / MariaDB via mariadb-operator). Use this for application credentials on managed databases. For the database itself use create-database. For TLS use manage-certificates. For application secrets unrelated to databases use manage-secrets.
Create and operate per-project encryption keys (KMSKey) backed by OpenBao Transit. Use for encrypting opaque payloads ≤ 64 KiB directly, or for envelope encryption of larger blobs (files, database fields, message-queue messages). Plaintext NEVER leaves OpenBao — workloads call encrypt/decrypt by referencing the key, not by holding key material. The same KMSKey type powers managed-K8s etcd encryption-at-rest. For storing whole secrets use manage-secrets. For TLS certificates use manage-certificates.
| name | use-kube-dc-cli |
| description | Use the kube-dc CLI for authentication, context switching, and namespace management. Covers login, use, ns, config, and kubectl integration. |
The kube-dc CLI provides browser-based OAuth authentication and context management for Kube-DC clusters. It integrates as a kubectl exec credential plugin.
# Linux (amd64)
sudo curl -sL https://github.com/kube-dc/kube-dc-public/releases/latest/download/kube-dc_linux_amd64 -o /usr/local/bin/kube-dc && sudo chmod +x /usr/local/bin/kube-dc
# Linux (arm64)
sudo curl -sL https://github.com/kube-dc/kube-dc-public/releases/latest/download/kube-dc_linux_arm64 -o /usr/local/bin/kube-dc && sudo chmod +x /usr/local/bin/kube-dc
# macOS (Apple Silicon)
sudo curl -sL https://github.com/kube-dc/kube-dc-public/releases/latest/download/kube-dc_darwin_arm64 -o /usr/local/bin/kube-dc && sudo chmod +x /usr/local/bin/kube-dc
# macOS (Intel)
sudo curl -sL https://github.com/kube-dc/kube-dc-public/releases/latest/download/kube-dc_darwin_amd64 -o /usr/local/bin/kube-dc && sudo chmod +x /usr/local/bin/kube-dc
kube-dc login --domain kube-dc.cloud --org {org-name}
kube-dc login --domain stage.kube-dc.com --org {org-name}
kube-dc login --domain internal.example.com --org {org-name} --ca-cert /path/to/ca.crt
Opens browser for Keycloak OAuth login. Tokens cached for ~30 days with auto-refresh.
kube-dc use {org}/{project} # Switch to specific project
kube-dc use # Interactive selection
Context names follow pattern: kube-dc/{domain}/{org}/{project}
kube-dc ns # List available namespaces (from JWT claims)
kube-dc ns {namespace} # Switch to specific namespace
kube-dc config show # Current context, server, cached credentials
kube-dc config get-contexts # List all kube-dc contexts
kube-dc logout # Remove credentials for current server
kube-dc logout --all # Remove all cached credentials
Before creating resources, always check the current context:
# Quick check
kubectl config current-context
# Detailed info (server, namespace, token status)
kube-dc config show
# Available namespaces for current user
kube-dc ns
The namespace tells you the project: namespace {org}-{project} → org={org}, project={project}.
After kube-dc login, the CLI configures kubectl with an exec credential plugin:
users:
- name: kube-dc@{org}
user:
exec:
apiVersion: client.authentication.k8s.io/v1
command: kube-dc
args: ["credential", "--server", "https://kube-api.{domain}:6443"]
Every kubectl command automatically:
kubectx # Lists all contexts including kube-dc ones
kubectx kube-dc/shalb/demo # Switch to Kube-DC context
| Path | Purpose |
|---|---|
~/.kube/config | Kubeconfig (Kube-DC entries merged, never overwrites others) |
~/.kube-dc/config.yaml | CLI configuration |
~/.kube-dc/credentials/ | Cached OAuth tokens (0600 permissions) |
After CLI operations:
# 1. Check credentials are cached
kube-dc config show
# Expected: shows server, user, org, valid access/refresh tokens
# 2. Verify kubectl works
kubectl get ns
# Expected: lists namespaces you have access to
# 1. Verify active context
kubectl config current-context
# Expected: kube-dc/{domain}/{org}/{project}
# 2. Verify namespace
kubectl config view --minify -o jsonpath='{.contexts[0].context.namespace}'
# Expected: {org}-{project}
# 1. Verify namespace changed
kube-dc ns
# Expected: asterisk (*) next to the active namespace
Success: Config shows valid tokens, kubectl commands return data. Failure:
kube-dc login --domain {domain} --org {org}kube-dc login rather than trying to extract tokens manually