Kubernetes Configuration Configuring Redis using a ConfigMap

来源:互联网 发布:巩义网络招聘平台 编辑:程序博客网 时间:2024/05/17 06:21

kubectl create configmap example-redis-config –from-file=docs/user-guide/configmap/redis/redis-config

kubectl get configmap example-redis-config -o yaml

data里面,key(redis-config):

apiVersion: v1data:  redis-config: |    maxmemory 2mb    maxmemory-policy allkeys-lrukind: ConfigMapmetadata:  creationTimestamp: 2016-03-30T18:14:41Z  name: example-redis-config  namespace: default  resourceVersion: "24686"  selfLink: /api/v1/namespaces/default/configmaps/example-redis-config  uid: 460a2b6e-f6a3-11e5-8ae5-42010af00002

配置pod

volumes:    - name:config    configMap:        name:example-redis-config        items:        - key:redis-config        path:redis.conf

创建pod:

kubectl create -f docs/user-guide/configmap/redis/redis-pod.yaml

查看pod中的key

kubectl exec -it redis redis-cliCONFIG GET maxmemoryCONFIG GET maxmemory-policy
原创粉丝点击