Redis Installation Guide for Kubernetes
Redis Installation Guide for Kubernetes
This guide demonstrates how to install Redis in a Kubernetes environment.
1. Prerequisites
Ensure the following before proceeding:
- A running Kubernetes cluster with
kubectlconfigured. - Basic knowledge of YAML configuration.
- Permissions to deploy resources in the cluster.
2. Create Redis Deployment and Service YAML Files
Create two YAML files: one for the Redis Deployment and another for the Service.
redis-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:6.2
ports:
- containerPort: 6379
redis-service.yaml
apiVersion: v1
kind: Service
metadata:
name: redis
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
3. Apply Redis YAML Files to the Cluster
Use the following commands to deploy Redis in your Kubernetes cluster:
kubectl apply -f redis-deployment.yaml
kubectl apply -f redis-service.yaml
This will create a Redis Pod and expose it using a Kubernetes Service.
4. Verify Installation
Check the status of your Redis Deployment and Service:
kubectl get pods
kubectl get services
To access Redis, use the Redis CLI tool or connect to the Pod directly:
kubectl exec -it <redis-pod-name> -- redis-cli
PING
If Redis is running properly, you should receive a PONG response.
Comments
Post a Comment