Coder Social home page Coder Social logo

abhra303 / dragonfly-operator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dragonflydb/dragonfly-operator

0.0 0.0 0.0 169 KB

A Kubernetes operator to install and manage Dragonfly instances.

License: Apache License 2.0

Go 89.58% Makefile 8.95% Dockerfile 1.46%

dragonfly-operator's Introduction

Dragonfly

Dragonfly Operator is a Kubernetes operator used to deploy and manage Dragonfly instances inside your Kubernetes clusters. Main features include:

  • Automatic failover
  • Scaling up/down the number of instances

Currently, Dragonfly Operator is in Alpha. You can find more information about Dragonfly in the official documentation.

Installation

Make sure to have your Kubernetes cluster up and running. Dragonfly Operator can be installed by running

# Install the CRD and Operator
kubectl apply -f https://raw.githubusercontent.com/dragonflydb/dragonfly-operator/main/manifests/dragonfly-operator.yaml

By default, the operator will be installed in the dragonfly-operator-system namespace.

Usage

Creating a Dragonfly instance

To create a sample Dragonfly instance, you can run the following command:

kubectl apply -f https://raw.githubusercontent.com/dragonflydb/dragonfly-operator/main/config/samples/v1alpha1_dragonfly.yaml

This will create a Dragonfly instance with 3 replicas. You can check the status of the instance by running

kubectl describe dragonflies.dragonflydb.io dragonfly-sample

A service of the form <dragonfly-name>.<namespace>.svc.cluster.local will be created, that selects the master instance. You can use this service to connect to the cluster. As pods are added/removed, the service will automatically update to point to the new master.

Connecting with redis-cli

To connect to the cluster using redis-cli, you can run:

kubectl run -it --rm --restart=Never redis-cli --image=redis:7.0.10 -- redis-cli -h dragonfly-sample.default

This will create a temporary pod that runs redis-cli and connects to the cluster. After pressing shift + R, You can then run Redis commands as usual. For example, to set a key and get it back, you can run

If you don't see a command prompt, try pressing enter.
dragonfly-sample.default:6379> GET 1
(nil)
dragonfly-sample.default:6379> SET 1 2
OK
dragonfly-sample.default:6379> GET 1
"2"
dragonfly-sample.default:6379> exit
pod "redis-cli" deleted

Scaling up/down the number of replicas

To scale up/down the number of replicas, you can edit the spec.replicas field in the Dragonfly instance. For example, to scale up to 5 replicas, you can run

kubectl patch dragonfly dragonfly-sample --type merge -p '{"spec":{"replicas":5}}'

Vertically scaling the instance

To vertically scale the instance, you can edit the spec.resources field in the Dragonfly instance. For example, to increase the CPU limit to 2 cores, you can run

kubectl patch dragonfly dragonfly-sample --type merge -p '{"spec":{"resources":{"requests":{"memory":"1Gi"},"limits":{"memory":"2Gi"}}}}'

Deleting a Dragonfly instance

To delete a Dragonfly instance, you can run

kubectl delete dragonfly dragonfly-sample

This will automatically delete all the resources (i.e pods and services) associated with the instance.

Uninstalling the operator

To uninstall the operator, you can run

kubectl delete -f https://raw.githubusercontent.com/dragonflydb/dragonfly-operator/main/manifests/dragonfly-operator.yaml

License

Copyright 2023 DragonflyDB authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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.