redis

Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

联系人:

安装次数:

浏览次数:

应用类型:

行业分类:

生产环节:

创建日期:2018-09-02

更新日期:2021-04-28

Redis

Redis is an advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

TL;DR

# Testing configuration$ helm install stable/redis
# Production configuration$ helm install stable/redis --values values-production.yaml

Introduction

This chart bootstraps a Redis deployment on a Kubernetes cluster using the Helm package manager.

Prerequisites

  • Kubernetes 1.8+
  • PV provisioner support in the underlying infrastructure

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release stable/redis

The command deploys Redis on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the Redis chart and their default values.

ParameterDescriptionDefault
image.registryRedis Image registrydocker.io
image.repositoryRedis Image namebitnami/redis
image.tagRedis Image tag{VERSION}
image.pullPolicyImage pull policyAlways
image.pullSecretsSpecify docker-registry secret names as an arraynil
cluster.enabledUse master-slave topologytrue
cluster.slaveCountNumber of slaves1
existingSecretName of existing secret object (for password authentication)nil
usePasswordUse passwordtrue
passwordRedis password (ignored if existingSecret set)Randomly generated
configmapRedis configuration file to be usednil
networkPolicy.enabledEnable NetworkPolicyfalse
networkPolicy.allowExternalDon't require client label for connectionstrue
serviceAccount.createSpecifies whether a ServiceAccount should be createdfalse
serviceAccount.nameThe name of the ServiceAccount to createGenerated using the fullname template
rbac.createSpecifies whether RBAC resources should be createdfalse
rbac.role.rulesRules to create[]
metrics.enabledStart a side-car prometheus exporterfalse
metrics.image.registryRedis exporter image registrydocker.io
metrics.image.repositoryRedis exporter image nameoliver006/redis_exporter
metrics.image.tagRedis exporter image tagv0.20.2
metrics.image.pullPolicyImage pull policyIfNotPresent
metrics.image.pullSecretsSpecify docker-registry secret names as an arraynil
metrics.extraArgsExtra arguments for the binary; possible values here{}
metrics.podLabelsAdditional labels for Metrics exporter pod{}
metrics.podAnnotationsAdditional annotations for Metrics exporter pod{}
metrics.service.typeKubernetes Service type (redis metrics)LoadBalancer
metrics.service.annotationsAnnotations for the services to monitor (redis master and redis slave service){}
metrics.service.loadBalancerIPloadBalancerIP if redis metrics service type is LoadBalancernil
metrics.resourcesExporter resource requests/limitMemory: 256Mi, CPU: 100m
persistence.existingClaimProvide an existing PersistentVolumeClaimnil
master.persistence.enabledUse a PVC to persist data (master node)true
master.persistence.pathPath to mount the volume at, to use other images/bitnami
master.persistence.subPathSubdirectory of the volume to mount at""
master.persistence.storageClassStorage class of backing PVCgeneric
master.persistence.accessModesPersistent Volume Access Modes[ReadWriteOnce]
master.persistence.sizeSize of data volume8Gi
master.statefulset.updateStrategyUpdate strategy for StatefulSetonDelete
master.statefulset.rollingUpdatePartitionPartition update strategynil
master.podLabelsAdditional labels for Redis master pod{}
master.podAnnotationsAdditional annotations for Redis master pod{}
master.portRedis master port6379
master.argsRedis master command-line args[]
master.disableCommandsComma-separated list of Redis commands to disable (master)FLUSHDB,FLUSHALL
master.extraFlagsRedis master additional command line flags[]
master.nodeSelectorRedis master Node labels for pod assignment{"beta.kubernetes.io/arch": "amd64"}
master.tolerationsToleration labels for Redis master pod assignment[]
master.affinityAffinity settings for Redis master pod assignment[]
master.schedulerNameName of an alternate schedulernil
master.service.typeKubernetes Service type (redis master)ClusterIP
master.service.portKubernetes Service port (redis master)6379
master.service.nodePortKubernetes Service nodePort (redis master)nil
master.service.annotationsannotations for redis master service{}
master.service.loadBalancerIPloadBalancerIP if redis master service type is LoadBalancernil
master.securityContext.enabledEnable security context (redis master pod)true
master.securityContext.fsGroupGroup ID for the container (redis master pod)1001
master.securityContext.runAsUserUser ID for the container (redis master pod)1001
master.resourcesRedis master CPU/Memory resource requests/limitsMemory: 256Mi, CPU: 100m
master.livenessProbe.enabledTurn on and off liveness probe (redis master pod)true
master.livenessProbe.initialDelaySecondsDelay before liveness probe is initiated (redis master pod)30
master.livenessProbe.periodSecondsHow often to perform the probe (redis master pod)30
master.livenessProbe.timeoutSecondsWhen the probe times out (redis master pod)5
master.livenessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed (redis master pod)1
master.livenessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.5
master.readinessProbe.enabledTurn on and off readiness probe (redis master pod)true
master.readinessProbe.initialDelaySecondsDelay before readiness probe is initiated (redis master pod)5
master.readinessProbe.periodSecondsHow often to perform the probe (redis master pod)10
master.readinessProbe.timeoutSecondsWhen the probe times out (redis master pod)1
master.readinessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed (redis master pod)1
master.readinessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.5
slave.serviceTypeKubernetes Service type (redis slave)LoadBalancer
slave.service.nodePortKubernetes Service nodePort (redis slave)nil
slave.service.annotationsannotations for redis slave service{}
slave.service.loadBalancerIPLoadBalancerIP if Redis slave service type is LoadBalancernil
slave.portRedis slave portmaster.port
slave.argsRedis slave command-line argsmaster.args
slave.disableCommandsComma-separated list of Redis commands to disable (slave)master.disableCommands
slave.extraFlagsRedis slave additional command line flagsmaster.extraFlags
slave.livenessProbe.enabledTurn on and off liveness probe (redis slave pod)master.livenessProbe.enabled
slave.livenessProbe.initialDelaySecondsDelay before liveness probe is initiated (redis slave pod)master.livenessProbe.initialDelaySeconds
slave.livenessProbe.periodSecondsHow often to perform the probe (redis slave pod)master.livenessProbe.periodSeconds
slave.livenessProbe.timeoutSecondsWhen the probe times out (redis slave pod)master.livenessProbe.timeoutSeconds
slave.livenessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed (redis slave pod)master.livenessProbe.successThreshold
slave.livenessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded.master.livenessProbe.failureThreshold
slave.readinessProbe.enabledTurn on and off slave.readiness probe (redis slave pod)master.readinessProbe.enabled
slave.readinessProbe.initialDelaySecondsDelay before slave.readiness probe is initiated (redis slave pod)master.readinessProbe.initialDelaySeconds
slave.readinessProbe.periodSecondsHow often to perform the probe (redis slave pod)master.readinessProbe.periodSeconds
slave.readinessProbe.timeoutSecondsWhen the probe times out (redis slave pod)master.readinessProbe.timeoutSeconds
slave.readinessProbe.successThresholdMinimum consecutive successes for the probe to be considered successful after having failed (redis slave pod)master.readinessProbe.successThreshold
slave.readinessProbe.failureThresholdMinimum consecutive failures for the probe to be considered failed after having succeeded. (redis slave pod)master.readinessProbe.failureThreshold
slave.podLabelsAdditional labels for Redis slave podmaster.podLabels
slave.podAnnotationsAdditional annotations for Redis slave podmaster.podAnnotations
slave.schedulerNameName of an alternate schedulernil
slave.securityContext.enabledEnable security context (redis slave pod)master.securityContext.enabled
slave.securityContext.fsGroupGroup ID for the container (redis slave pod)master.securityContext.fsGroup
slave.securityContext.runAsUserUser ID for the container (redis slave pod)master.securityContext.runAsUser
slave.resourcesRedis slave CPU/Memory resource requests/limitsmaster.resources
slave.affinityEnable node/pod affinity for slaves{}

The above parameters map to the env variables defined in bitnami/redis. For more information please refer to the bitnami/redis image documentation.

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ helm install --name my-release   --set password=secretpassword     stable/redis

The above command sets the Redis server password to secretpassword.

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

$ helm install --name my-release -f values.yaml stable/redis

Tip: You can use the default values.yaml

Note for minikube users: Current versions of minikube (v0.24.1 at the time of writing) provision hostPath persistent volumes that are only writable by root. Using chart defaults cause pod failure for the Redis pod as it attempts to write to the /bitnami directory. Consider installing Redis with --set persistence.enabled=false. See minikube issue 1990 for more information.

NetworkPolicy

To enable network policy for Redis, installa networking plugin that implements the Kubernetes NetworkPolicy spec,and set networkPolicy.enabled to true.

For Kubernetes v1.5 & v1.6, you must also turn on NetworkPolicy by settingthe DefaultDeny namespace annotation. Note: this will enforce policy for all pods in the namespace:

kubectl annotate namespace default "net.beta.kubernetes.io/network-policy={"ingress":{"isolation":"DefaultDeny"}}"

With NetworkPolicy enabled, only pods with the generated client label will beable to connect to Redis. This label will be displayed in the outputafter a successful install.

Persistence

The Bitnami Redis image stores the Redis data and configurations at the /bitnami path of the container.

By default, the chart mounts a Persistent Volume at this location. The volume is created using dynamic volume provisioning. If a Persistent Volume Claim already exists, specify it during installation.

By default, the chart persists both data and configuration. If you wish to persist only the data directory set persistence.path to /bitnami/redis/data and persistence.subPath to redis/data.

Existing PersistentVolumeClaim

  1. Create the PersistentVolume
  2. Create the PersistentVolumeClaim
  3. Install the chart
$ helm install --set persistence.existingClaim=PVC_NAME stable/redis

Metrics

The chart optionally can start a metrics exporter for prometheus. The metrics endpoint (port 9121) is exposed in the service. Metrics can be scraped from within the cluster using something similar as the described in the example Prometheus scrape configuration. If metrics are to be scraped from outside the cluster, the Kubernetes API proxy can be utilized to access the endpoint.

咨询反馈