kubectl create configmap --from-file 命令允许用户从本地文件系统上的文件或目录创建 Kubernetes ConfigMap。ConfigMap 是一种 Kubernetes 资源,用于将配置数据以键值对的形式存储,以便在 Pod 中使用。 如何使用 --from-file 选项: 指定文件:使用 --from-file=[fileName] 形式,可以将单个文件的内容创建为一个 Con...
kubectl create configmap game-config-3 --from-file=<my-key-name>=<path-to-file> 1. 1.3 指定目录创建 示例 configs 目录下的config-1和config-2内容如下所示: 创建命令: kubectl create configmap test-config3 --from-file=./configs 1. 结果如图中data内容所示: 可以看到指定目录创建时configmap内容中...
根据文件创建一个名为exp-config的configmap: kubectl create configmap exp-config --from-file=path/to/bar 1. 使用指定的keys创建一个名为exp-config的configmap: kubectl create configmap exp-config --from-file=key1=/path/to/bar/file1.txt --from-file=key2=/path/to/bar/file2.txt 1....
string。 自选。 当useConfigMapFile = false && command != login && command != logout时使用。 指定要在configMap中插入的键和文本值。 例如,--from-literal=key1=value1或--from-literal=key2="top secret"。 versionOrLocation-Kubectl string。 允许的值:version、location(指定位置)。 默认值:version。
patchkubectl patch (-f filename | type name) [-p patch|--patch-file file] [options]以 merge 形式对资源的某部分字段的值进行修改 replacekubectl replace -f filename [flags]从配置文件或 stdin 替换资源对象 设置命令 命令语法说明 labelkubectl label [--overwrite] (-f filename | type name) key...
kubectl create configmap my-config --from-file=path/to/bar kubectl create namespace my-namespace $ priorityclass NAME --value=VALUE --global-default=BOOL [--dry-run] kubectl create priorityclass default-priority --value=1000 --global-default=true --description="default priority" ...
4.ConfigMap映射 # 创建configMapkubectl create configmap nginx-conf --from-file=nginx.conf# 查看configMapkubectl get configmaps# yaml文件内配置configMap: name: nginx-conf#ConfigMap名字
kubectl create configmap <cm_name> --from-file=<fileName>.properties 2.2、expose 获取一个复制控制器、服务、部署或pod,并将其作为新的Kubernetes服务公开。 2.2.1、暴露 Pod 端口 kubectl expose deployment nginx --port=80 --type=NodePort 2.3、run ...
Use when useConfigMapFile = false && command != login && command != logout. Specifies the keys and literal values to insert in configMap. For example, --from-literal=key1=value1 or --from-literal=key2="top secret".versionOrLocation - Kubectl string. Allowed values: version, location (...
3. Configmap: 是一种用于记录pod本身或其内部配置信息的API资源,可以认为是通过API形式存储的配置文件。 4. Endpoints: 用于记录每个service的pod的**真实物理**ip和port的对应关系,包括service是TCP还是UDP等。 5. Event: 用于记录集群中的事件,可以认为类似于日志里的一条记录。 6. LimitRange: 用于记录各个...