kubectl create configmap game-config --from-file=../configmap/ #基于configmap目录创建名为game-config的configmap。 #--from-file指定在目录下的所有文件都会被用在 ConfigMap 里面创建一个键值对,键的名字就是文件名,值就是文件的内容 2.使用文件创建 kubectl create configmap game-config-2 --from-file=./...
kubectl create configmap demo-configmap--from-file=<目录名称或文件名称>🔔 说明:本方式创建的 ConfigMap 对象中,每一组键值对的 key 是文件名,value 是文件内容 # 方式二:使用 env 文件 kubectl create configmap demo-configmap--from-env-file=<env文件名称>🔔 说明:本方式创建的 ConfigMap 对象中,直接...
kubectl create configmap game-config-2 --from-file=$PATH 注:容器以 subPath 卷挂载方式使用 ConfigMap 时,将无法接收 ConfigMap 的更新。 subPath: node-exporter.sh
利用kubectl create configmap命令使用--from-file选项可基于文件内容来创建ConfigMap对象,它的命令格式如下:kubectl create configmap <configmap_name> --from-file=<[key=]source> 1.准备配置文件我们先准备好要载入容器的配置文件,等下通过kubectl create configmap config_name --from-file 来指定我们的配置文件即...
1、第一种:通过命令行创建ConfigMap 创建 名为mysql.conf的 configmap kubectl create configmap mysql.conf --from-literal=datadir=/var/lib/mysql --from-literal=socket=/var/lib/mysql/mysql.sock 1. 查看configmap详细信息: kubectl describe cm mysql.conf ...
f storage-configmap-nginx-file.yaml root@master1ha1:~# kubectl get cm NAME DATA AGE cm-nginx-conf-files 1 15m cm-nginx-index 1 10m kube-root-ca.crt 1 37d #查看 root@master1ha1:~# kubectl get cm cm-nginx-index -o yaml apiVersion: v1 data: index.html: Nginx Configmap GGBANG!
1 [root@k8s-master storage]# kubectl create configmap game-config-2 --from-file=/root/k8s_practice/storage/configmap/game.properties 2 configmap/game-config-2 created 3 [root@k8s-master storage]# 4 [root@k8s-master storage]# kubectl get configmap game-config-2 5 NAME DATA AGE 6 game-con...
利用kubectl create configmap命令使用--from-literal选项可在命令行直接给出键值对来创建ConfigMap对象,重复使用此选项则可以传递多个键值对,命令格式如下:kubectl create configmap configmap_name --from-literal=key-name01=value-1 例如下面用命令创建special-config configmap时传递来两个键值对:键值对第一个key为mys...
例如kubectl create configmap hello —from-file=<文件路径> 3. Service 元数据: metadata。实例标签:即spec里面的selector字段,通过app:nginx标签找到对应的实例(Pod)。端口号映射:targerPort是容器实际监听的端口,port是Service产生的虚拟IP所对应的端口,它并不是将来的NodePort,NodePort的取值是随机的。 服务暴露...
KubernetesOperator 需要颁发 主机证书的CA的根CA证书。运行以下命令以创建MongoDB Ops Manager在数据库 Pod 的同一命名空间中包含根ConfigMapCA : kubectl -n <metadata.namespace> create configmap <root-ca-configmap-name> \ --from-file=mms-ca.crt ...