Configmap Secret logo

Configmap Secret

Community
chaterm
configmap-secret

Kubernetes ConfigMap 与 Secret

Overview

Publisherchaterm
Repositoryterminal-skills
Skill nameconfigmap-secret
Stars
59
Forks
12
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by chaterm on GitHub. Read the source before you install it.

Installation

Install the Configmap Secret AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/chaterm/terminal-skills/tree/main/kubernetes/configmap-secret
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/chaterm/terminal-skills.git /tmp/terminal-skills
mkdir -p .claude/skills
cp -r /tmp/terminal-skills/kubernetes/configmap-secret .claude/skills/configmap-secret
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Configmap Secret in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Configmap Secret on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Configmap Secret is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

ConfigMap 与 Secret

概述

配置管理、敏感信息处理等技能。

ConfigMap

创建 ConfigMap

bash
# 从字面值创建
kubectl create configmap my-config --from-literal=key1=value1 --from-literal=key2=value2

# 从文件创建
kubectl create configmap my-config --from-file=config.properties
kubectl create configmap my-config --from-file=my-key=config.properties

# 从目录创建
kubectl create configmap my-config --from-file=config-dir/

# 从环境文件创建
kubectl create configmap my-config --from-env-file=env.properties

ConfigMap YAML

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: my-config
data:
  # 简单键值对
  database_url: "mysql://localhost:3306/mydb"
  log_level: "info"
  
  # 多行配置文件
  nginx.conf: |
    server {
        listen 80;
        server_name localhost;
        location / {
            root /usr/share/nginx/html;
        }
    }
  
  # JSON 配置
  config.json: |
    {
      "debug": true,
      "port": 8080
    }

使用 ConfigMap

环境变量方式
yaml
spec:
  containers:
  - name: app
    env:
    # 单个键
    - name: DATABASE_URL
      valueFrom:
        configMapKeyRef:
          name: my-config
          key: database_url
    # 所有键
    envFrom:
    - configMapRef:
        name: my-config
挂载为文件
yaml
spec:
  containers:
  - name: app
    volumeMounts:
    - name: config-volume
      mountPath: /etc/config
  volumes:
  - name: config-volume
    configMap:
      name: my-config
      # 可选:指定特定键
      items:
      - key: nginx.conf
        path: nginx.conf
挂载为单个文件(不覆盖目录)
yaml
spec:
  containers:
  - name: app
    volumeMounts:
    - name: config-volume
      mountPath: /etc/app/config.json
      subPath: config.json
  volumes:
  - name: config-volume
    configMap:
      name: my-config

Secret

创建 Secret

bash
# 从字面值创建
kubectl create secret generic my-secret --from-literal=username=admin --from-literal=password=secret123

# 从文件创建
kubectl create secret generic my-secret --from-file=ssh-privatekey=~/.ssh/id_rsa

# TLS Secret
kubectl create secret tls tls-secret --cert=cert.pem --key=key.pem

# Docker Registry Secret
kubectl create secret docker-registry regcred \
  --docker-server=registry.example.com \
  --docker-username=user \
  --docker-password=password \
  --docker-email=user@example.com

Secret YAML

yaml
apiVersion: v1
kind: Secret
metadata:
  name: my-secret
type: Opaque
data:
  # Base64 编码
  username: YWRtaW4=
  password: c2VjcmV0MTIz
---
# 使用 stringData(自动编码)
apiVersion: v1
kind: Secret
metadata:
  name: my-secret
type: Opaque
stringData:
  username: admin
  password: secret123

Secret 类型

yaml
# Opaque(默认)
type: Opaque

# TLS
type: kubernetes.io/tls
data:
  tls.crt: <base64>
  tls.key: <base64>

# Docker Registry
type: kubernetes.io/dockerconfigjson
data:
  .dockerconfigjson: <base64>

# Basic Auth
type: kubernetes.io/basic-auth
data:
  username: <base64>
  password: <base64>

# SSH Auth
type: kubernetes.io/ssh-auth
data:
  ssh-privatekey: <base64>

使用 Secret

环境变量方式
yaml
spec:
  containers:
  - name: app
    env:
    - name: DB_PASSWORD
      valueFrom:
        secretKeyRef:
          name: my-secret
          key: password
    envFrom:
    - secretRef:
        name: my-secret
挂载为文件
yaml
spec:
  containers:
  - name: app
    volumeMounts:
    - name: secret-volume
      mountPath: /etc/secrets
      readOnly: true
  volumes:
  - name: secret-volume
    secret:
      secretName: my-secret
      defaultMode: 0400
镜像拉取凭证
yaml
spec:
  imagePullSecrets:
  - name: regcred
  containers:
  - name: app
    image: registry.example.com/myapp:latest

操作命令

bash
# 查看 ConfigMap
kubectl get configmap
kubectl describe configmap my-config
kubectl get configmap my-config -o yaml

# 查看 Secret
kubectl get secret
kubectl describe secret my-secret
kubectl get secret my-secret -o yaml

# 解码 Secret
kubectl get secret my-secret -o jsonpath='{.data.password}' | base64 -d

# 编辑
kubectl edit configmap my-config
kubectl edit secret my-secret

# 删除
kubectl delete configmap my-config
kubectl delete secret my-secret

常见场景

场景 1:应用配置热更新

yaml
# 使用 ConfigMap 挂载(自动更新)
spec:
  containers:
  - name: app
    volumeMounts:
    - name: config
      mountPath: /etc/config
  volumes:
  - name: config
    configMap:
      name: my-config
# 注意:subPath 挂载不会自动更新

场景 2:多环境配置

bash
# 创建不同环境的 ConfigMap
kubectl create configmap app-config-dev --from-file=config-dev/
kubectl create configmap app-config-prod --from-file=config-prod/

# 在 Deployment 中引用
# 通过 Kustomize 或 Helm 管理不同环境

场景 3:外部 Secret 管理

yaml
# 使用 External Secrets Operator
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: my-external-secret
spec:
  refreshInterval: 1h
  secretStoreRef:
    name: aws-secrets-manager
    kind: SecretStore
  target:
    name: my-secret
  data:
  - secretKey: password
    remoteRef:
      key: prod/db/password

场景 4:配置文件模板

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  application.yaml: |
    server:
      port: ${SERVER_PORT:8080}
    database:
      url: ${DATABASE_URL}
      username: ${DATABASE_USER}

最佳实践

bash
# 1. 不要在 Git 中存储 Secret
# 使用 Sealed Secrets 或 External Secrets

# 2. 限制 Secret 访问权限
# 使用 RBAC 控制

# 3. 定期轮换 Secret
# 使用自动化工具

# 4. 使用 immutable ConfigMap/Secret(K8s 1.21+)
yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: immutable-config
immutable: true
data:
  key: value

故障排查

问题排查方法
配置未更新检查是否使用 subPath、重启 Pod
Secret 解码错误检查 Base64 编码是否正确
权限问题检查 defaultMode、RBAC
挂载失败检查 ConfigMap/Secret 是否存在
bash
# 检查挂载
kubectl exec pod-name -- ls -la /etc/config
kubectl exec pod-name -- cat /etc/config/key

# 检查环境变量
kubectl exec pod-name -- env | grep KEY

Frequently asked questions

What does the Configmap Secret AI skill do?

Kubernetes ConfigMap 与 Secret

Why use Configmap Secret on TypingMind?

Because you install it once and use it with any model. Configmap Secret is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Configmap Secret in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/chaterm/terminal-skills/tree/main/kubernetes/configmap-secret. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Configmap Secret?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Configmap Secret?

As many as you like. As long as a model supports skills, you can use Configmap Secret with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Configmap Secret AI skill free?

Yes. It is published on GitHub by chaterm under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇