pkdone / minikube-mongodb-demo Goto Github PK
View Code? Open in Web Editor NEWDemo project showing how to deploy MongoDB in a local Minikube Kubernetes environment
License: MIT License
Demo project showing how to deploy MongoDB in a local Minikube Kubernetes environment
License: MIT License
Hi,
I am trying this demo for Prod POC and after running "generate.sh"
I see pod in pending state after I do kubectl describe for pod I see issue like below
kubectl describe po/mongod-0
FailedScheduling PersistentVolumeClaim is not bound: "mongodb-persistent-storage-claim-mongod-0" (repeated 6 times)
So I had similar issue while deploying sidecar mongo demo(Sorry for giving refrenence)
There I created PV and PVC manully then created cluster which worked ok but not upto expectation.
So do I need to do same here
kubectl get pv,pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
pvc/mongodb-persistent-storage-claim-mongod-0 Pending standard 9m
kubectl describe pvc/mongodb-persistent-storage-claim-mongod-0
Name: mongodb-persistent-storage-claim-mongod-0
Namespace: default
StorageClass: standard
Status: Pending
Volume:
Labels: environment=test
replicaset=MainRepSet
role=mongo
Annotations: volume.beta.kubernetes.io/storage-class=standard
Capacity:
Access Modes:
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
10m 34s 42 persistentvolume-controller Warning ProvisioningFailed storageclass.storage.k8s.io "standard" not found
Is this provisioner is default with kubernetes or we need to get it from somewhere "ProvisioningFailed storageclass.storage.k8s.io "standard" not found"
# kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:17:43Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Its 3 Master 3 Minion HA Cluster
Please advice
Best Regards
Ganesh
I'm trying this tutorial on macOS 10.12.6.
When running the configure_repset_auth.sh
I have the following errors.
I'm new to kubernetes so I'm not sure what is going on.
After running the generate.sh
script I have all three mongo pods running.
$ ./configure_repset_auth.sh abc123
Configuring the MongoDB Replica Set
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
{
"ok" : 0,
"errmsg" : "replSetInitiate quorum check failed because not all proposed set members responded affirmatively: mongod-1.mongodb-service.default.svc.cluster.local:27017 failed with Couldn't get a connection within the time limit, mongod-2.mongodb-service.default.svc.cluster.local:27017 failed with Couldn't get a connection within the time limit",
"code" : 74,
"codeName" : "NodeNotFound"
}
Waiting for the Replica Set to initialise...
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
{
"info" : "run rs.initiate(...) if not yet done for the set",
"ok" : 0,
"errmsg" : "no replset config has been received",
"code" : 94,
"codeName" : "NotYetInitialized"
}
Creating user: 'main_admin'
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
2018-03-05T10:57:01.779+0000 E QUERY [thread1] Error: couldn't add user: not master :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1437:15
@(shell eval):1:1
command terminated with exit code 252
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.3", GitCommit:"d2835416544f298c919e2ead3be3d0864b52323b", GitTreeState:"clean", BuildDate:"2018-02-07T12:22:21Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"", Minor:"", GitVersion:"v1.9.0", GitCommit:"925c127ec6b946659ad0fd596fa959be43f0cc05", GitTreeState:"clean", BuildDate:"2018-01-26T19:04:38Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
$ minikube version
minikube version: v0.25.0
The thing is when you connect to the mongodb-service exposing the three pods, it will just connect to a random mongo, so how can it be defined to connect to the primary mongo?
How would you configure this to access from outside minikube? Otherwise, the tutorial seems to have worked - it looks like things are up and running. But I'd like to be able to hook up Robo3T from my workstation to poke at the mongo database.
After running generate.sh and when I try to run,
db.getSiblingDB('admin').auth("main_admin", "abc123");
I get,
"Error: Authentication failed."
But the pod is in running state.
In 1.3.1 Replication Test there is the following code block:
$ kubectl exec -it mongod-1 -c mongod-container bash
$ mongo
> db.getSiblingDB('admin').auth("main_admin", "abc123");
> db.setSlaveOk(1);
> use test;
> db.testcoll.find();
Following this block results in an error, which seems to point at an incorrect ordering of commands.
MainRepSet:SECONDARY> db.getSiblingDB('admin').auth('admin', 'password');
1
MainRepSet:SECONDARY> db.setSlaveOk(1);
MainRepSet:SECONDARY> use test;
switched to db test
MainRepSet:SECONDARY> db.testcoll.find();
Error: error: {
"operationTime" : Timestamp(1523998362, 1),
"ok" : 0,
"errmsg" : "not master and slaveOk=false",
"code" : 13435,
"codeName" : "NotMasterNoSlaveOk",
"$clusterTime" : {
"clusterTime" : Timestamp(1523998362, 1),
"signature" : {
"hash" : BinData(0,"AD2neVaDyfgPsQSzueLs+HYtv4w="),
"keyId" : NumberLong("6545521577759342593")
}
}
}
Running the db.setSlaveOk(1);
after the use test;
allows it to work as expected:
MainRepSet:SECONDARY> db.setSlaveOk(1);
MainRepSet:SECONDARY> db.testcoll.find();
{ "_id" : ObjectId("5ad65e6cad27b03ddadf87c9"), "a" : 1 }
{ "_id" : ObjectId("5ad65e71ad27b03ddadf87ca"), "b" : 2 }
Before submitting a pull request reordering the commands I wanted to check that this wasn't simply user error, or an issue due to versioning of anything.
This deployment was built using the yaml file in the repo, so the current mongo image being pulled contains the following versions:
root@mongod-1:/# mongo --version
MongoDB shell version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
allocator: tcmalloc
modules: none
build environment:
distmod: debian81
distarch: x86_64
target_arch: x86_64
root@mongod-1:/# mongod --version
db version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
allocator: tcmalloc
modules: none
build environment:
distmod: debian81
distarch: x86_64
target_arch: x86_64
on aws 3 node cluster of kubernetes i am getting pod has unbound immediate PersistentVolumeClaims but its working in minikube please explain
Details on stackoverflow:
https://stackoverflow.com/questions/58757912/mongodb-yaml-selector-does-not-match-template-labels
Also apiVersion
needs to change from apps/v1beta1 to apps/v1
Pods kept crashing for no reason. By checking the logs of the container it complained that it wasn't assigned enough storage for mongodb's wieredTigerCache - it must be at least 0.25.
The size is assigned to 0.1 under commands in the YAML-file. When changed to 0.25 everything was good.
In the readme you wrote
db.setSlaveOk(1);
But it doesn't work. I found out that the correct usage is
db.getMongo().setSlaveOk()
like it is documented here:
https://docs.mongodb.com/manual/reference/method/Mongo.setSlaveOk/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.