命令行创建
命令行创建
kubectl create cm app-config --from-literal=LOG_LEVEL=info --from-literal=MAX_CONN=100
kubectl create cm nginx-conf --from-file=nginx.conf
kubectl create cm env-file --from-env-file=app.env
kubectl create cm app-config --from-literal=LOG_LEVEL=info --dry-run=client -o yaml > cm.yamlYAML 声明
YAML 声明
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
namespace: prod
data:
LOG_LEVEL: info
app.properties: |
retries=3
timeout=30s键名允许字母数字与 - _ .;整个对象有大小限制(合计约 1MiB),大文件用挂载卷或对象存储。