Kubernetes contrib config doesn't work with minikube?

Hi,

I am evaluating dgraph and wanted to test it locally, using minikube. I found https://github.com/dgraph-io/dgraph/blob/master/contrib/config/kubernetes/dgraph-ha.yaml which should launch 3 alpha, 3 zero, and 1 ratel pod.

$ minikube delete && minikube start

Deleting local Kubernetes cluster...                                        
Machine deleted.                                                            
Starting local Kubernetes v1.10.0 cluster...                                
Starting VM...                       
Getting VM IP address...                                          
Moving files into cluster...                                     
Setting up certs...                                              
Connecting to cluster...                                                                                                                                                                                                                                                                    
Setting up kubeconfig...                                         
Starting cluster components...                                   
Kubectl is now configured to use the cluster.                    
Loading cached images from config file.

$ kubectl apply -f dgraph-ha.yaml

service/dgraph-zero-public created                                                 
service/dgraph-alpha-public created                                                
service/dgraph-ratel-public created                                                
service/dgraph-zero created                                                        
service/dgraph-alpha created                                                       
statefulset.apps/dgraph-zero created                                               
statefulset.apps/dgraph-alpha created                                              
deployment.apps/dgraph-ratel created

After about 5 minutes

$ kubectl logs dgraph-zero-1

I1113 18:40:54.683336       9 run.go:90] Setting up grpc listener at: 0.0.0.0:5080
I1113 18:40:54.683423       9 run.go:90] Setting up http listener at: 0.0.0.0:6080
I1113 18:40:54.695494       9 node.go:152] Setting raft.Config to: &{ID:2 peers:[] ElectionTick:100 HeartbeatTick:1 Storage:0xc0001484e0 Applied:0 MaxSizePerMsg:1048576 MaxInflightMsgs:256 CheckQuorum:false PreVote:true ReadOnlyOption:0 Logger:0x1d112c0}                              
I1113 18:40:54.696034       9 node.go:291] Group 0 found 1 entries
I1113 18:40:54.699431       9 pool.go:118] CONNECTED to dgraph-zero-0.dgraph-zero.default.svc.cluster.local:5080
I1113 18:40:56.067317       9 raft.go:422] [2] Starting node
I1113 18:40:56.067444       9 node.go:84] 2 became follower at term 0
I1113 18:40:56.067480       9 node.go:84] newRaft 2 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
I1113 18:40:56.067486       9 node.go:84] 2 became follower at term 1
I1113 18:40:56.067776       9 run.go:229] Running Dgraph Zero...
I1113 18:41:04.704030       9 node.go:84] 2 [term: 1] received a MsgApp message with higher term from 1 [term: 2]
I1113 18:41:04.704071       9 node.go:84] 2 became follower at term 2
I1113 18:41:04.704166       9 node.go:84] raft.node: 2 elected leader 1 at term 2
I1113 18:41:04.714100       9 node.go:174] Setting conf state to nodes:1
I1113 18:41:04.714160       9 raft.go:547] Done applying conf change at 2
I1113 18:41:04.714239       9 node.go:174] Setting conf state to nodes:1 nodes:2
I1113 18:41:04.714303       9 raft.go:547] Done applying conf change at 2
I1113 18:41:04.719312       9 pool.go:118] CONNECTED to dgraph-alpha-0.dgraph-alpha.default.svc.cluster.local:7080
I1113 18:41:04.727493       9 node.go:174] Setting conf state to nodes:1 nodes:2 nodes:3
I1113 18:41:04.727530       9 raft.go:547] Done applying conf change at 2
E1113 18:41:04.727544       9 raft.go:552] While applying proposal: Invalid group proposal
I1113 18:41:04.730696       9 pool.go:118] CONNECTED to dgraph-alpha-1.dgraph-alpha.default.svc.cluster.local:7080
E1113 18:41:04.733658       9 pool.go:178] Echo error from dgraph-zero-2.dgraph-zero.default.svc.cluster.local:5080. Err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = "transport: Error while dialing dial tcp: lookup dgraph-zero-2.dgraph-zero.default.svc.cluster.local: no such host"
I1113 18:41:04.733684       9 pool.go:118] CONNECTED to dgraph-zero-2.dgraph-zero.default.svc.cluster.local:5080
I1113 18:41:04.761282       9 pool.go:118] CONNECTED to dgraph-alpha-2.dgraph-alpha.default.svc.cluster.local:7080
E1113 18:41:04.781616       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:04.897971       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:05.117658       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:05.528562       9 raft.go:552] While applying proposal: Invalid address
I1113 18:41:05.888883       9 node.go:174] Setting conf state to nodes:1 nodes:2 nodes:3
I1113 18:41:05.888920       9 raft.go:547] Done applying conf change at 2
E1113 18:41:06.335741       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:07.943567       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:11.149119       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:14.359211       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:17.565304       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:20.774523       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:23.980906       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:27.202708       9 raft.go:552] While applying proposal: Invalid address
E1113 18:41:30.411483       9 raft.go:552] While applying proposal: Invalid address

Several other pods have similar errors, for example

$ kubectl logs dgraph-zero-0
is printing this error once every second or so

I1113 18:49:18.846673       9 zero.go:375] Got connection request: addr:"dgraph-alpha-1.dgraph-alpha.default.svc.cluster.local:7080" 
E1113 18:49:18.851417       9 raft.go:552] While applying proposal: Invalid address
I1113 18:49:18.851803       9 zero.go:477] Connected: id:162 group_id:2 addr:"dgraph-alpha-1.dgraph-alpha.default.svc.cluster.local:7080" 
I1113 18:49:22.054836       9 zero.go:375] Got connection request: addr:"dgraph-alpha-1.dgraph-alpha.default.svc.cluster.local:7080" 
E1113 18:49:22.059462       9 raft.go:552] While applying proposal: Invalid address
I1113 18:49:22.059492       9 zero.go:477] Connected: id:163 group_id:2 addr:"dgraph-alpha-1.dgraph-alpha.default.svc.cluster.local:7080" 

I do not have an available remote kubernetes cluster that has storage configured. Has anyone else run into this, and are those errors expected?

Can you start the Zeros StatefulSet first and then the Alpha StatefulSet?

Sure. I split the config into 3 sections (zero,alpha,ratel).
Created all the Zero pods
(waited ~30s, after 3 pods were created)
Created all the Alpha pods
(waited ~30s after 3 pods were created)

That seemed to work.

@dmai do you want me to contribute that upstream? Because kubectl only applies configuration on a singular file (I think), it’d make sense to split that up and have a README in a high-availability folder with the steps.

Thanks for trying it out. Feel free to make a PR, but there’s probably an issue we need to fix here since the current config used to work.

This is fixed in PR #2749 that’s been merged into master today, so it’ll be in the next release.

For now I added a delay in the config so that the Alphas start up after the Zeros.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.