当前位置:网站首页>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
边栏推荐
- TypeError: ‘Collection‘ object is not callable. If you meant to call the ......
- Learning Android II from scratch - activity
- Knowledge points sorting: ES6
- 《2021多多阅读报告》发布,95后、00后图书消费潜力攀升
- What are instruction cycles, machine cycles, and clock cycles?
- Informatics Aosai yibentong 1212: letters | openjudge 2.5 156: Letters
- Deep learning notes - semantic segmentation and data sets
- Making message board with PHP + MySQL
- JS determines whether the numeric string contains characters
- Unity C e-learning (IV)
猜你喜欢

Details related to fingerprint payment

Excel uses the functions of replacement, sorting and filling to comprehensively sort out financial data

The applet calls the function of scanning QR code and jumps to the path specified by QR code

Wechat payment function

MySQL slow query

Learning Android V from scratch - UI

Backup MySQL database with Navicat

Perfect test of coil in wireless charging system with LCR meter

Field injection is not recommended using @ Autowired
![[winui3] write an imitation Explorer file manager](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[winui3] write an imitation Explorer file manager
随机推荐
Leetcode 1547: minimum cost of cutting sticks
Manually write smart pointer shared_ PTR function
[2022 ICLR] Pyraformer: Low-Complexity Pyramidal Attention for Long-Range 时空序列建模和预测
This call when the transaction does not take effect
js 判断数字字符串中是否含有字符
C list field sorting contains numbers and characters
Deep learning notes - object detection and dataset + anchor box
MySQL memo (for your own query)
静态流水线和动态流水线的区别认识
Informatics Aosai yibentong 1212: letters | openjudge 2.5 156: Letters
Deep learning notes - semantic segmentation and data sets
QPushbutton 槽函数被多次触发
TypeError: ‘Collection‘ object is not callable. If you meant to call the ......
独立站运营 | FaceBook营销神器——聊天机器人ManyChat
The WebService interface writes and publishes calls to the WebService interface (I)
Knowledge points sorting: ES6
Excel protects worksheets and workbooks from damage
Progress of innovation training (III)
Informatics Olympiad 1955: [11noip popularization group] Swiss round | openjudge 4.1 4363: Swiss round | Luogu p1309 [noip2011 popularization group] Swiss round
Unity C e-learning (IV)