Valkey is a high-performance in-memory data store that serves as a drop-in alternative to Redis. Deploying Valkey in Kubernetes ensures scalability and easy management of your caching layer. In this guide, we’ll go through the process of installing Valkey in Kubernetes using Bitnami’s Helm chart.
Prerequisites
Before proceeding, ensure you have the following:
- A running Kubernetes cluster
- Helm installed on your local machine
kubectl
configured to interact with your cluster
Adding the Bitnami Helm Repository
First, add the Bitnami Helm repository and update your local Helm chart repository to ensure you have the latest versions available:
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
Installing Valkey in Kubernetes
To install Valkey, use the following command:
helm install my-valkey bitnami/valkey
This command deploys Valkey with default settings. You can customize the installation using --set
flags or a values file.
Disabling Password Authentication
By default, Valkey requires authentication. If you want to disable password authentication, use the following command:
helm install my-valkey bitnami/valkey --set auth.enabled=false
Or, if Valkey is already installed, disable authentication by upgrading the release:
helm upgrade my-valkey bitnami/valkey --set auth.enabled=false
This setting removes the password requirement, allowing clients to connect without authentication. Ensure that your Kubernetes cluster has proper security measures in place if you choose to disable authentication.
Accessing Valkey
To access Valkey from within your cluster, you can use a Kubernetes service. Run the following command to get the service details:
kubectl get svc --namespace default
For external access, you may need to configure an Ingress or a LoadBalancer service depending on your setup.
Port Forwarding Valkey Service
If you want to access Valkey from your local machine, you can use kubectl port-forward
to expose the service:
kubectl port-forward svc/my-valkey-master 6379:6379
This will forward requests from your local port 6379 to the Valkey service running inside your cluster.
Testing Valkey Connection
Once port forwarding is set up, you can test if Valkey is working using redis-cli
:
redis-cli -h 127.0.0.1 -p 6379 ping
If Valkey is running correctly, you should receive a response:
PONG
Uninstalling Valkey
If you need to remove Valkey from your Kubernetes cluster, use:
helm uninstall my-valkey
This will delete all associated resources.
Conclusion
Deploying Valkey in Kubernetes using Helm is straightforward and provides a scalable caching solution. By customizing configurations like authentication settings, you can adapt it to your security requirements. Be sure to review your cluster’s security policies when disabling authentication.