当前位置:网站首页>configmap
configmap
2022-04-23 05:04:00 【canger_】
establish ConfigMap
Be careful : ConfigMap The key name in must be a legal DNS Domain , Contains only numbers and letters 、 Dashes 、 Draw lines and dots below , The first dot symbol is optional
Use command kubectl establish ConfigMap
$ kubectl create configmap app-config --from-literal=qos=1
This command creates a file called app-config Of ConfigMap, And contains only configuration items qos=1
As shown below :
root@VM-16-4-ubuntu:~/code/charts/stable# kubectl create configmap app-config --from-literal=qos=1
configmap/app-config created
root@VM-16-4-ubuntu:~/code/charts/stable# kubectl get cm
NAME DATA AGE
app-config 1 6s
kube-root-ca.crt 1 25d
root@VM-16-4-ubuntu:~/code/charts/stable# kubectl describe cm app-config
Name: app-config
Namespace: default
Labels: <none>
Annotations: <none>
Data
====
qos:
----
1
BinaryData
====
Events: <none>
root@VM-16-4-ubuntu:~/code/charts/stable#
If you want more than one configuration item, it comes with more than one --from-literal
adopt Yaml establish ConfigMap
command :
$ kubectl create -f app-config.yaml
Yaml Format :
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
app-config.ini: | [MQ] qos=1
Create... From the contents of the file ConfigMap
ConfigMap You can also store coarse-grained configuration data , For example, a complete configuration file .kubectl create configmap
The command supports reading files from disk , And store the contents of the file separately as
ConfigMap Items in
$ kubectl create configmap app-config --from-file=app-config.ini
After creation, it is as follows :
root@VM-16-4-ubuntu:~# kubectl get cm app-config -o yaml
apiVersion: v1
data:
app-config.ini: |
[MQ]
qos=1
kind: ConfigMap
metadata:
creationTimestamp: "2022-02-15T07:03:34Z"
name: app-config
namespace: default
resourceVersion: "2829911"
uid: c9f74808-129b-4cf2-96c3-5489194609ea
When running the above command , kubectl Will find in the current directory app-config.ini
file , And store the contents of the file in ConfgMap China and Israel app-config.ini
Under the entry for the key name , Of course, you can also specify the key name manually :
$ kubectl create configmap app-config --from-file=customkey=app-config.ini
After creation, it is as follows :
root@VM-16-4-ubuntu:~# kubectl get cm app-config -o yaml
apiVersion: v1
data:
customkey: |
[MQ]
qos=1
kind: ConfigMap
metadata:
creationTimestamp: "2022-02-15T07:04:51Z"
name: app-config
namespace: default
resourceVersion: "2830017"
uid: 58c4184c-6d09-4ecb-9dd3-a252c9dc04df
Same as when using literal quantity , Used multiple times --from-file Parameter can add multiple file entries
Create... From a folder ConfigMap
In addition to introducing each file separately , You can even import all the files in a folder
$ kubectl create configmap my-config --from-file=/path/to/dir
In this case , kubectl A separate entry is created for each file in the folder , Only those file names can be used as legal ConfigMap File with key name
see ConfigMap
command :
$ kubectl get cm
as follows :
root@VM-16-4-ubuntu:~# kubectl get cm
NAME DATA AGE
app-config 1 8m17s
kube-root-ca.crt 1 25d
modify ConfigMap
command :
$ kubectl edit cm cm-name
for example :
root@VM-16-4-ubuntu:~# kubectl edit cm app-config
Edit cancelled, no changes made.
modify ConfigMap Pay attention to pod Whether the application in will reload the configuration , Otherwise, restart is required pod To read the changed configuration again .
Delete ConfigMap
command :
$ kubectl delete cm cm-name
for example :
root@VM-16-4-ubuntu:~/code/charts/stable# kubectl delete cm app-config
configmap "app-config" deleted
版权声明
本文为[canger_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220552063667.html
边栏推荐
- 深度学习笔记 —— 数据增广
- Learning Android from scratch -- Introduction
- 2022/4/22
- The 8 diagrams let you see the execution sequence of async / await and promise step by step
- Using MySQL with Oracle
- Deep learning notes - data expansion
- MySQL -- execution process and principle of a statement
- Data security has become a hidden danger. Let's see how vivo can make "user data" armor again
- View analysis of scenic spots in ArcGIS
- Sword finger offer: the median in the data stream (priority queue large top heap small top heap leetcode 295)
猜你喜欢
Excel uses the functions of replacement, sorting and filling to comprehensively sort out financial data
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
Sword finger offer: the path with a certain value in the binary tree (backtracking)
PHP+MySQL 制作留言板
深度学习笔记 —— 物体检测和数据集 + 锚框
Deep learning notes - data expansion
[database] MySQL multi table query (I)
Details related to fingerprint payment
Deep learning notes - semantic segmentation and data sets
How can continuous integration (CI) / continuous delivery (CD) revolutionize automated testing
随机推荐
This call when the transaction does not take effect
Define defines constants and macros, pointers and structures
Analysis of POM files
DIY is an excel version of subnet calculator
Backup MySQL database with Navicat
Progress of innovation training (III)
MySQL memo (for your own query)
深度学习笔记 —— 物体检测和数据集 + 锚框
Progress of innovation training (IV)
Excel protects worksheets and workbooks from damage
【数据库】MySQL单表查询
redis数据类型有哪些
Introduction to raspberry pie 3B - system installation
Arduino UNO r3+LCD1602+DHT11
QPushbutton 槽函数被多次触发
Innovation training (V) mid term inspection
PHP counts the number of files in the specified folder
[database] MySQL basic operation (basic operation ~)
泰克示波器DPO3054自校准SPC失败维修
【数据库】MySQL多表查询(一)