网站是先解析还是先备案优才网站建设
网站是先解析还是先备案,优才网站建设,什么网站做的好看,泰安做网站哪家好持续集成部署-k8s-配置与存储-配置管理#xff1a;配置文件不可变 1. 配置文件不可变场景2. 配置 ConfigMap 为不可修改 1. 配置文件不可变场景
上一篇我们说到#xff0c;对于 ConfigMap 的热更新操作#xff0c;我们在创建了ConfigMap 之后#xff0c;由于某种原因… 持续集成部署-k8s-配置与存储-配置管理配置文件不可变 1. 配置文件不可变场景2. 配置 ConfigMap 为不可修改 1. 配置文件不可变场景
上一篇我们说到对于 ConfigMap 的热更新操作我们在创建了ConfigMap 之后由于某种原因我们的配置文件需要变动了k8s 支持我们热更新配置文件的内容但是在某些情况下为了生产环境的稳定性一些重要的文件希望上线后就不允许修改了。
此时在配置 ConfigMap 时可以设置 immutable: true 来禁止修改。
2. 配置 ConfigMap 为不可修改
查看当前环境中 configMap
[rootdocker-54 config]# kubectl get cm
NAME DATA AGE
kube-root-ca.crt 1 194d
nginx-conf-cm 1 19d
spring-boot-test-aliases-yaml 1 20d
spring-boot-test-yaml 1 20d
test-dir-config 2 20d
test-env-config 2 20d
test-key-value-config 2 20d
[rootdocker-54 config]# 修改 test-dir-config 的配置设置 immutable: true 然后直接保存退出
[rootdocker-54 config]# kubectl edit cm test-dir-config
# Please edit the object below. Lines beginning with a # will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:db.properties: |username: zhangsanpassword: abc123456redis.properties: |host: 127.0.0.1port: 6379
kind: ConfigMap
metadata:creationTimestamp: 2023-11-05T02:56:57Zname: test-dir-confignamespace: defaultresourceVersion: 12701596uid: 9a6c3cd3-a2d9-41c2-91b8-229e8e6d19ca
immutable: true
~
/tmp/kubectl-edit-214262249.yaml 20L, 557C written
configmap/test-dir-config edited
[rootdocker-54 config]# 可以看到当前还是可以修改的。
接着我们再次尝试修改
# Please edit the object below. Lines beginning with a # will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
# configmaps test-dir-config was not valid:
# * data: Forbidden: field is immutable when immutable is set
#
apiVersion: v1
data:db.properties: |username: lisipassword: abc123456redis.properties: |host: 127.0.0.1port: 6379
immutable: true
kind: ConfigMap
metadata:creationTimestamp: 2023-11-05T02:56:57Zname: test-dir-confignamespace: defaultresourceVersion: 13734572uid: 9a6c3cd3-a2d9-41c2-91b8-229e8e6d19ca
~
~
/tmp/kubectl-edit-685283905.yaml 23L, 665C可以看到上面在我修改了 username的值为 lisi 之后保存然后提示configmaps test-dir-config was not valid: data: Forbidden: field is immutable when immutable is set
这里告诉我们由于之前设置过 immutable: true所以现在不让我们修改了。
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/90439.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!