当前位置:网站首页>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
边栏推荐
- Manually write smart pointer shared_ PTR function
- Spell it! Two A-level universities and six B-level universities have abolished master's degree programs in software engineering!
- Thoughts on a small program
- redis数据类型有哪些
- View, modify and delete [database] table
- MySQL uses or to query SQL, and SQL execution is very slow
- Detailed explanation of hregionserver
- Learning Android II from scratch - activity
- Barcode generation and decoding, QR code generation and decoding
- COM in wine (2) -- basic code analysis
猜你喜欢

Use model load_ state_ Attributeerror appears when dict(): 'STR' object has no attribute 'copy‘

Learning Android II from scratch - activity

深度学习笔记 —— 微调

Use the built-in function of win to transfer files between two computers in the same LAN (the speed is the same as that between local disks)

Detailed explanation of the differences between TCP and UDP
![[database] MySQL multi table query (I)](/img/c7/43167aa6169c24a8d9734032775335.png)
[database] MySQL multi table query (I)

Details related to fingerprint payment

Backup MySQL database with Navicat

泰克示波器DPO3054自校准SPC失败维修

Live delivery form template - automatically display pictures - automatically associate series products
随机推荐
Acid of MySQL transaction
What are instruction cycles, machine cycles, and clock cycles?
Independent station operation | Facebook marketing artifact - chat robot manychat
Day.js 常用方法
AQS source code reading
JS détermine si la chaîne de nombres contient des caractères
Solve valueerror: argument must be a deny tensor: 0 - got shape [198602], but wanted [198602, 16]
Learning Android II from scratch - activity
Opencv + clion face recognition + face model training
MySQL slow query
SCP command details
[WinUI3]編寫一個仿Explorer文件管理器
Define defines constants and macros, pointers and structures
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
PHP+MySQL 制作留言板
Cross border e-commerce | Facebook and instagram: which social media is more suitable for you?
Innovation training (XII) reptile
How to exit VIM
[database] MySQL multi table query (I)
Chapter III project schedule management of information system project manager summary