Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)17k · #10768

kubesphere-devops-credentials

Skill này làm gì

Skill này giúp agent AI thiết lập thông tin xác thực cho pipeline KubeSphere DevOps. Skill dành cho người vận hành cần pipeline truy cập kho Git, cụm hoặc dịch vụ bên ngoài một cách an toàn.

Khi nào nên dùng

  • ✓Khi bạn cần thêm một kho Git vào dự án DevOps bằng SSH hoặc tên người dùng và mật khẩu.
  • ✓Khi một pipeline cần kubeconfig hoặc API token để truy cập một cụm hoặc dịch vụ.
  • ✓Khi thông tin xác thực cần được chuyển sang một dự án DevOps khác hoặc một thông tin xác thực không hoạt động.

Liên kết skill

https://github.com/kubesphere/kubesphere/blob/master/skills/kubesphere-devops-credentials/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/kubesphere/kubesphere/blob/master/skills/kubesphere-devops-credentials/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể thêm kho GitHub riêng tư của chúng tôi vào dự án DevOps bằng khóa SSH không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent giải thích loại thông tin xác thực phù hợp, rồi tạo nó dưới dạng secret Kubernetes với các nhãn mà KubeSphere cần. Sau khi được đồng bộ sang Jenkins, các pipeline có thể dùng nó.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

KubeSphere DevOps Credentials

Overview

Credentials in KubeSphere DevOps are Kubernetes Secrets with specific labels and annotations. They are synced to Jenkins for use in pipelines. Supported types include SSH keys, username/password, and secret tokens.

When to Use

  • Creating credentials for Git repositories
  • Setting up deployment credentials (kubeconfig, registry)
  • Managing API tokens for external services
  • Troubleshooting credential access issues
  • Migrating credentials between DevOps projects

Credential Types

Type Use Case Secret Key
SSH Git repositories username, privatekey
Basic Username/password username, password
Secret API tokens, secrets secret
Kubeconfig Kubernetes clusters kubeconfig (v1.1.x only)
SSH Username/Pass Git with user/pass username, password
String Generic text/tokens secret

Resource Structure

Credentials are stored as Kubernetes Secrets with DevOps labels:

apiVersion: v1
kind: Secret
metadata:
  name: my-credential
  namespace: project-xxx  # DevOps project namespace
  labels:
    devops.kubesphere.io/credential: "true"
  annotations:
    credential.devops.kubesphere.io/syncstatus: successful
    credential.devops.kubesphere.io/type: ssh|basic-auth|secret-text
stringData:
  username: git-user
  privatekey: |
    -----BEGIN OPENSSH PRIVATE KEY-----
    ...
    -----END OPENSSH PRIVATE KEY-----
type: credential.devops.kubesphere.io/ssh  # CRITICAL: Must use credential.devops.kubesphere.io/* type, NOT Opaque!

⚠️ CRITICAL: Secret Type Must Be credential.devops.kubesphere.io/*

The type field must be one of:

  • credential.devops.kubesphere.io/basic-auth
  • credential.devops.kubesphere.io/ssh-auth
  • credential.devops.kubesphere.io/secret-text
  • credential.devops.kubesphere.io/kubeconfig

Using type: Opaque will result in:

  • Credential sync status stuck at "pending"
  • Jenkins cannot find the credential
  • Pipeline builds fail with "CredentialId could not be found"

Controller Logic: The credential controller only watches secrets with types starting with credential.devops.kubesphere.io/ (see devopscredential_controller.go line 102). Secrets with type: Opaque are completely ignored.

API Endpoints

Operation Method Endpoint
List Credentials GET /kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials
Create Credential POST /kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials
Get Credential GET /kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials/{credential}
Update Credential PUT /kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials/{credential}
Delete Credential DELETE /kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials/{credential}
Get Usage GET /kapis/devops.kubesphere.io/v1alpha2/namespaces/{devops}/credentials/{credential}/usage

Common Operations

List Credentials

curl "https://kubesphere-api/kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials" \
  -H "Authorization: Bearer $TOKEN"

Create SSH Credential

curl -X POST "https://kubesphere-api/kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "apiVersion": "v1",
    "kind": "Secret",
    "metadata": {
      "name": "github-ssh-key",
      "annotations": {
        "credential.devops.kubesphere.io/type": "ssh"
      }
    },
    "stringData": {
      "username": "git",
      "privatekey": "-----BEGIN OPENSSH PRIVATE KEY-----\n...\n-----END OPENSSH PRIVATE KEY-----"
    },
    "type": "credential.devops.kubesphere.io/ssh-auth"
  }'

Create Basic Auth Credential

curl -X POST "https://kubesphere-api/kapis/devops.kubesphere.io/v1alpha3/namespaces/{devops}/credentials" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "apiVersion": "v1",
    "kind": "Secret",
    "metadata": {
      "name": "docker-registry",
      "annotations": {
        "credential.devops.kubesphere.io/type": "basic-auth"
      }
    },
    "stringData": {
      "username": "docker-user",
      "password": "docker-password"
    },
    "type": "credential.devops.kubesphere.io/basic-auth"
  }'

Câu hỏi thường gặp

Những loại thông tin xác thực nào được hỗ trợ?

Skill liệt kê SSH, tên người dùng và mật khẩu, secret token, kubeconfig và văn bản chung.

Thông tin xác thực được lưu ở đâu?

Chúng được lưu dưới dạng secret Kubernetes với nhãn DevOps và được đồng bộ sang Jenkins.

Agent có kiểm tra vì sao một thông tin xác thực bị lỗi không?

Có. Skill bao gồm xử lý sự cố truy cập và trạng thái đồng bộ.

Chi tiết

Mô tả gốc của tác giả

Use when managing credentials in KubeSphere DevOps, including repository credentials, kubeconfig, and API tokens

repo: kubesphere/kubesphere

Độ phổ biến

Sao GitHub
17k
Vị trí xếp hạng
#10768
Giấy phép
—
Cập nhật
14/7/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự