当前位置:网站首页>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
边栏推荐
- Deep learning notes - data expansion
- Independent station operation | Facebook marketing artifact - chat robot manychat
- Details related to fingerprint payment
- The difference between static pipeline and dynamic pipeline
- Sword finger offer: push in and pop-up sequence of stack
- HRegionServer的详解
- Agile practice | agile indicators to improve group predictability
- Painless upgrade of pixel series
- Transaction isolation level of MySQL transactions
- Barcode generation and decoding, QR code generation and decoding
猜你喜欢

How can continuous integration (CI) / continuous delivery (CD) revolutionize automated testing

深度学习笔记 —— 语义分割和数据集

Learning Android from scratch -- Introduction
![[database] MySQL multi table query (I)](/img/c7/43167aa6169c24a8d9734032775335.png)
[database] MySQL multi table query (I)

Introduction to raspberry pie 3B - system installation

Making message board with PHP + MySQL

Cross border e-commerce | Facebook and instagram: which social media is more suitable for you?

MySQL - index
![[database] MySQL basic operation (basic operation ~)](/img/0c/a8d858fa74ffed2a266ca77c783c7f.png)
[database] MySQL basic operation (basic operation ~)

跨境电商 | Facebook 和 Instagram:哪个社交媒体更适合你?
随机推荐
Deep learning notes - fine tuning
用LCR表完美测试无线充电系统中的线圈
PHP+MySQL 制作留言板
信息学奥赛一本通 1212:LETTERS | OpenJudge 2.5 156:LETTERS
Various ways of writing timed tasks of small programs
Chapter II project scope management of information system project manager summary
Knowledge points sorting: ES6
QPushbutton 槽函数被多次触发
2022/4/22
Repair of self calibration SPC failure of Tektronix oscilloscope dpo3054
泰克示波器DPO3054自校准SPC失败维修
Use AES encryption - reuse the wisdom of predecessors
Unity C e-learning (IV)
Custom switch control
深度学习笔记 —— 微调
Opencv + clion face recognition + face model training
A trinomial expression that causes a null pointer
Making message board with PHP + MySQL
Implementation of switching windows and capturing data in selenium mode
【数据库】表的查看、修改和删除