Redis and Kubernetes Together - Helm - ArgoCD

Redis and Kubernetes Together - Helm - ArgoCD

So, your application needs a low-latency, high-performance, ultra-reliable, in-memory, memory-optimized, key-value data store for seamless operation?

Hey! You can use Redis for that, it checks all the boxes above.

But I need to deploy my application on kubernetes, can I host Redis on my kubernetes cluster.

Ah! That comes the juicy part, so let's jump directly into it without any further ado.


Advantages and Drawbacks

Let me first discuss the Advantages & Drawbacks of this setup before we further delve into it. This will help you understand and decide whether this setup satisfy your needs.


Advantages

1. Simple Pre-configured Setup: It is easier to set up and manage. Bitnami Redis charts come with a well-tested configuration that simplifies the deployment process. This includes default configurations that adhere to best practices for Redis deployment.

2. Low Latency: Can offer lower latency for read and write operations since there’s no sharding or complex replication logic involved.

3. Resource Efficiency: Consumes fewer resources compared to a clustered setup, which can be beneficial for small to medium-sized deployments.

4. Consistency: Master-replica setups ensure strong consistency since there is no partitioning of data.

5. Scalability & High Availability: With Bitnami Redis charts, horizontal scaling of Redis instances can be achieved smoothly.

The Bitnami Redis chart supports master-slave replication, allowing for a high-availability setup. In case of a master node failure, a slave can be promoted to ensure continuity of service.

6. Persistence: The chart provides options for persistent storage using PersistentVolumeClaims (PVCs). This ensures data durability and recovery in case of pod restarts or failures.

Can use AOF (Append Only File) or RDB (Redis Database) snapshots for data persistence, making data recovery straightforward.

7. Customization: Bitnami charts are highly configurable. You can customize resource requests/limits, affinity rules, and other parameters to suit your specific use case and resource constraints.

8. Ease of Management: A powerful and easy-to-use platform for deploying, upgrading, and managing Redis.

9. Community and Documentation: Bitnami has strong community support and comprehensive documentation, which can be very helpful for troubleshooting and optimizing deployments.


Drawbacks

1. Scalability: Limited scalability. While master-replica can handle read-heavy workloads better by offloading reads to replicas, it still suffers from a single point of failure and write bottleneck.

2. High Availability: Master-replica provides basic failover capabilities but doesn’t match the high availability and failover capabilities of Redis-Cluster.

3. Single Point of Failure: The master node is a single point of failure in a master-replica setup, leading to potential downtime during failover events.

4. Replication Lag: There can be replication lag between the master and replicas, which might lead to stale reads if replicas are used for read operations.

5. Operational Challenges: Managing a distributed stateful application like Redis on Kubernetes comes with operational challenges. Ensuring data consistency, handling node failures, and performing upgrades require careful planning and execution.

6. Persistent Storage Complexity: While persistent storage is supported, it introduces complexities related to storage provisioning, I/O performance, and data recovery strategies.

7. Security: Running Redis in Kubernetes requires careful configuration to ensure security. Misconfigurations can expose Redis to potential security threats. This includes managing secrets, configuring network policies, and ensuring that only authorized entities have access to Redis.

Overview of the Redis Deployment

Topology


Installing with the Helm-cli

Pre-requisites

  • Kubernetes 1.23+
  • Helm 3.8.0+
  • PV provisioner support in the underlying infrastructure

$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm repo update
$ helm repo ls        
Bitnami Repo added

Once you have added the bitnami repo to your helm lists

You can check the versions of redis charts available by

$ helm search repo bitnami/redis --versions        
Bitnami Redis chart versions

Installing the helm chart

# Installing the Helm charts for redis (default chart vesion)
# Here "my-redis" is the releaseName
# When no chart version is provided, Helm will always default to the latest chart version.

$ helm install my-redis bitnami/redis
        
# You can also customize the values for this helm my creating a values file

$ helm install my-redis bitnami/redis -f custom-values.yaml        
# custom-values.yaml

master:
  password: 'your-password-here'
persistence:
  enabled: true        
# Installing specific version of the helm chart
# Remember 19.6.0 this is the CHART VERSION not the APP VERSION

$ helm install my-redis bitnami/redis --version 19.6.0        


Installing with ArgoCD

Pre-requisites

  • Kubernetes 1.23+
  • ArgoCD
  • PV provisioner support in the underlying infrastructure
  • ArgoCD basic knowledge


Creating the Redis Application

  • Installing with ArgoCD is even simpler.
  • Identify the Helm chart and version you want to install
  • Create an ArgoCD application

# redis-argocd-application.yaml

# Project: Default
# chart version: 19.6.0
# releaseName: redis
# helm values customized: auth.enable = false
# namespace for redis deployment: redis-app
# deploy it in the same cluster
# self heal & prune enabled
# create namepace in not present

project: default
source:
  repoURL: 'https://charts.bitnami.com/bitnami'
  targetRevision: 19.6.0
  helm:
    parameters:
      - name: auth.enabled
        value: 'false'
    releaseName: redis
  chart: redis
destination:
  namespace: redis-app
  name: in-cluster
syncPolicy:
  automated:
    prune: true
    selfHeal: true
  syncOptions:
    - CreateNamespace=true
        

Apply this yaml using

kubectl apply -f redis-argocd-application.yaml -n <your argocd applications namespace>        


Congratulations ????

All done!!

Redis will be deployed and be ready to use.



要查看或添加评论,请登录

Neelesh Ranjan Srivastava的更多文章

社区洞察

其他会员也浏览了