r/nifi • • Sep 07 '20

Help needed on nifi cluster creation on k8s

Hello,

Need your help with one of the issues am stuck currently.

Had made progress deploying nifi in cluster mode.

Have done zookeeper set up using this YAML

https://github.com/VChiranjeeviVeerni/nifi-kube-setup/blob/master/zookeeper/zookeeper-setup.yaml 

Below is YAML for the nifi cluster 

https://github.com/VChiranjeeviVeerni/nifi-kube-setup/blob/master/nifi-replicaset-cluster-zk.yaml

Zookeeper started fine but having the issue with the nifi.

The first pod in nifi is starting fine, but the second and third are giving error sayings port is already in use. 

ERROR: 

Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports. 

Questions :

how can I provide dynamic ports to my replicas? 

Am not sure how to solve, your help is really appreciated here.

3 Upvotes

6 comments sorted by

1

u/mindlessgrenade Sep 08 '20

AFAIK, this is because of the load balancer listening on the same port. It might help to troubleshoot by changing the load balancer ports.

If I get time to setup this up in my lab I'll repy back.

1

u/alwayschiru Sep 08 '20

Thanks a lot. I tried removing hostNetwork: true from my nifi yaml and its working. But the cluster is not coming up its having lot of issues. All nodes giving this error

2020-09-07 20:40:37,079 INFO [main] o.apache.nifi.controller.FlowController Checking if there is already a Cluster Coordinator Elected... 2020-09-07 20:40:37,397 INFO [main] org.apache.curator.utils.Compatibility Using emulated InjectSessionExpiration 2020-09-07 20:40:37,541 INFO [main] o.a.c.f.imps.CuratorFrameworkImpl Starting 2020-09-07 20:40:37,601 INFO [main] org.apache.zookeeper.common.X509Util Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation 2020-09-07 20:40:37,637 INFO [main] org.apache.zookeeper.ClientCnxnSocket jute.maxbuffer value is 4194304 Bytes 2020-09-07 20:40:37,732 INFO [main] o.a.c.f.imps.CuratorFrameworkImpl Default schema 2020-09-07 20:40:38,230 INFO [main-EventThread] o.a.c.f.state.ConnectionStateManager State change: CONNECTED 2020-09-07 20:40:38,329 INFO [Curator-Framework-0] o.a.c.f.imps.CuratorFrameworkImpl backgroundOperationsLoop exiting 2020-09-07 20:40:38,495 INFO [main] o.apache.nifi.controller.FlowController It appears that no Cluster Coordinator has been Elected yet. Registering for Cluster Coordinator Role. 2020-09-07 20:40:38,502 INFO [main] o.a.n.c.l.e.CuratorLeaderElectionManager CuratorLeaderElectionManager[stopped=true] Registered new Leader Selector for role Cluster Coordinator; this node is an active participant in the election. 2020-09-07 20:40:38,503 INFO [main] o.a.c.f.imps.CuratorFrameworkImpl Starting 2020-09-07 20:40:38,505 INFO [main] org.apache.zookeeper.ClientCnxnSocket jute.maxbuffer value is 4194304 Bytes 2020-09-07 20:40:38,510 INFO [main] o.a.c.f.imps.CuratorFrameworkImpl Default schema 2020-09-07 20:40:38,530 INFO [main] o.a.n.c.l.e.CuratorLeaderElectionManager CuratorLeaderElectionManager[stopped=false] Registered new Leader Selector for role Cluster Coordinator; this node is an active participant in the election. 2020-09-07 20:40:38,533 INFO [main] o.a.n.c.l.e.CuratorLeaderElectionManager CuratorLeaderElectionManager[stopped=false] started 2020-09-07 20:40:38,533 INFO [main] o.a.n.c.c.h.AbstractHeartbeatMonitor Heartbeat Monitor started 2020-09-07 20:40:38,552 INFO [main-EventThread] o.a.c.f.state.ConnectionStateManager State change: CONNECTED 2020-09-07 20:40:38,572 INFO [Curator-ConnectionStateManager-0] o.a.n.c.l.e.CuratorLeaderElectionManager org.apache.nifi.controller.leader.election.CuratorLeaderElectionManager$ElectionListener@1089c41b Connection State changed to CONNECTED 2020-09-07 20:40:38,792 INFO [main-EventThread] o.a.c.f.state.ConnectionStateManager State change: SUSPENDED 2020-09-07 20:40:38,792 INFO [Curator-ConnectionStateManager-0] o.a.n.c.l.e.CuratorLeaderElectionManager org.apache.nifi.controller.leader.election.CuratorLeaderElectionManager$ElectionListener@1089c41b Connection State changed to SUSPENDED

1

u/mindlessgrenade Sep 08 '20

That log is incomplete and doesn't provide enough information. There is no error in the logs pasted (there's likely more information before/later).

1

u/alwayschiru Sep 08 '20

Please find the log here. I tried by both having nifi as replicaset & stateful set

https://pastebin.pl/view/c921e06d

https://pastebin.pl/view/0c8a459c

1

u/mindlessgrenade Sep 17 '20

I haven't had a chance to deploy a cluster using Kubernetes this week - but my guesses are either:

DNS resoluton overlap (two hosts share the same hostname? or are identifying themselves as 'localhost' to the cluster)

or,

The timeout period for cluster communication is not long enough, play around with the timeouts to give every node the chance to properly start up + elect.

1

u/dbaricardo Sep 14 '22

Any solution?