configmap-secret

Solid

Kubernetes ConfigMap 与 Secret

AI & Automation 1 stars 0 forks Updated yesterday Apache-2.0

Install

View on GitHub

Quality Score: 79/100

Stars 20%
10
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# 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 ...

Details

Author
ryukyagamilight
Repository
ryukyagamilight/terminal-skills
Created
5 months ago
Last Updated
yesterday
Language
N/A
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category