Giter Site home page Giter Site logo

redis's Introduction

Setup Minikube Cluser on EC2 machine and run Redis Cluser using helm - using userdata to install Docker, Minikube, kubectl and Helm

  • This document describe a steps on how to setup minikube cluster on EC2 and run Redis cluser using Helm chart.

Prerequisites

aws configure
  • if you would like to use different profile use following command to set default profile.
export AWS_DEFAULT_PROFILE=<profiel name>

Download code from the following repo

git clone -b main https://github.com/amarsingh3d/redis.git

Create EC2 machine

  • To create EC2 machine run following commands.
  • Switch to terraform directory and replace following variables.
cd redis/terraform

  • update variable cidr_blocks with your IP so we can do ssh to machine.
variable "cidr_blocks" {
  default = "103.69.14.12/32"

}

  • Update public key for SSH
variable "pub_key" {
  description = "Minikube pub key"
  type        = string
  default     = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDPNmt"

}
  • Run Terraform init, plan and apply
terraform init \
terraform fmt \
terraform validate
terraform plan
terraform apply
  • Take a note of output of public IP

Create Redis Cluster and Redis client POD

  • SSH to EC2 machine
ssh -i <path of you private key> ubuntu@<server_IP>
  • take a clone of git repository on the server
git clone -b main https://github.com/amarsingh3d/redis.git
  • Switch to correct directory
cd redis/helm
  • Start minikube cluster
minikube start
  • varify minikube status
minikube status
  • Create Redis cluster
helm install redis-cluster redis-cluster/ -f redis-cluster/values.yaml
  • Create redis client
helm install redis-client redis-client/ -f redis-client/values.yaml
  • Get pod details and make sure all pod are up and running
kubectl get pod
  • get the redis cluster auth password
export REDIS_PASSWORD=$(kubectl get secret --namespace default redis-cluster -o jsonpath="{.data.redis-password}" | base64 -d)
echo $REDIS_PASSWORD
  • connect redis-client pod and create redis key
kubectl get pod

Take a node of redis-client POD name

  • connect redis client pod
kubectl exec --tty -i < redis client pod name here > -c redis-client /bin/bash
  • Connect redis master
redis-cli -h redis-cluster-master
  • authorize usign password, replace password from above 3rd last steps
auth <passwrod >
  • Test redis using ping command output should be Pong
ping
  • Create new key
set OxKey OxValue
  • get newlly added key
get OxKey

If output is expected everything is up and running as expected.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.