Giter VIP home page Giter VIP logo

kubernetes-flocker-mongodb-replica-set-example's Introduction

Running a Mongo Replica Set on Kubernetes

requirements

  • A Kubernetes cluster
  • Flocker installed

1. setup environment variables in your local client terminal

export FLOCKER_CONTROL_SERVICE=
export KUBECONFIG=clusters/<NAME OF K8s CLUSTER>/kubeconfig

2. replace the following variables in the Makefile

DISK_SIZE=100G
KUBECONFIG=clusters/replica-m3-2xlarge-set/kubeconfig
CONTROL_DNS=<Flocker Control DNS>
INITIAL_NODE_ID=ec570512

3. create volumes

I created a make file to make creation of volumes easier based on how many active mongo pods are currently deployed`

$ make create-volume

# flockerctl --control-service=ec2-52-86-240-175.compute-1.amazonaws.com create -m name=flockermongorc-3 -s 100G --node=ec570512
# created dataset in configuration, manually poll state with 'flocker-volumes list' to see it show up.

4. deploy a replica pod

$ make add-replica

This will deploy a pod to your cluster and create a copy of the spec file for you to manually use if needed from a template file.

kubectl create -f mongo-rc-1.yaml kubectl delete -f mongo-rc-1.yaml

Useful Kubernetes commands

kubectl get po,no -o wide

NAME            READY     STATUS              RESTARTS   AGE       NODE                        IP
mongo-1-w7paz   2/2       Running             0          43m       ip-10-0-0-96.ec2.internal   <none>
mongo-2-ytmn1   2/2       Running             0          2h        ip-10-0-0-97.ec2.internal   <none>
mongo-3-527pz   0/2       ContainerCreating   0          10s       ip-10-0-0-98.ec2.internal   <none>

kubectl describe po mongo-1-w7paz This will output the pod ip address and information about the volyme under Volumes you will see instead of Flocker but it will be working Volumes: mongo-persistent-storage: default-token-y21eu: Type: Secret (a secret that should populate this volume) SecretName: default-token-y21eu

To use emptydir (no flocker)

There are no make commands yet for this I have included 4 example replication controller templates for using emptydir in /emptydir

kubectl create -f emptydir/mongo-rc-1.yaml

kubernetes-flocker-mongodb-replica-set-example's People

Contributors

stephenitis avatar

Stargazers

Leif Shackelford avatar

Watchers

James Cloos avatar  avatar  avatar

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.