Last active
March 20, 2024 07:10
-
-
Save bketelsen/a2d353d0318736c9fa23 to your computer and use it in GitHub Desktop.
This gist represents all the manifests you'll need to run a redundant and fault-tolerant NSQ cluster on Kubernetes. NSQ Admin's http interface is available on port 14171 on any node. There's an issue with NSQ Admin if you're running more than one lookupd service, so I recommend running just one lookupd until I figure it out.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqadmin-http", | |
"kind": "Service", | |
"apiVersion": "v1beta1", | |
"port": 14171, | |
"protocol": "TCP", | |
"selector": { "name": "nsqadmin" } | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqadminController", | |
"kind": "ReplicationController", | |
"apiVersion": "v1beta1", | |
"desiredState": { | |
"replicas": 1, | |
"replicaSelector": {"name": "nsqadmin"}, | |
"podTemplate": { | |
"desiredState": { | |
"manifest": { | |
"version": "v1beta1", | |
"id": "nsqadmin", | |
"containers": [{ | |
"name": "nsqd", | |
"image": "bketelsen/nsqadmin", | |
"ports": [{"containerPort": 4171}], | |
}] | |
} | |
}, | |
"labels": {"name": "nsqadmin"} | |
}}, | |
"labels": {"name": "nsqadmin"} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqd-http", | |
"kind": "Service", | |
"apiVersion": "v1beta1", | |
"port": 14151, | |
"containerPort": 4151, | |
"protocol": "TCP", | |
"selector": { "name": "nsqd" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqd-tcp", | |
"kind": "Service", | |
"apiVersion": "v1beta1", | |
"port": 14150, | |
"containerPort": 4150, | |
"protocol": "TCP", | |
"selector": { "name": "nsqd" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqdController", | |
"kind": "ReplicationController", | |
"apiVersion": "v1beta1", | |
"desiredState": { | |
"replicas": 5, | |
"replicaSelector": {"name": "nsqd"}, | |
"podTemplate": { | |
"desiredState": { | |
"manifest": { | |
"version": "v1beta1", | |
"id": "nsqd", | |
"volumes": {["name": "nsqdpersistence"]}, | |
"containers": [{ | |
"name": "nsqd", | |
"image": "bketelsen/nsqd:latest", | |
"volumes": {["name":"nsqdpersistence","mountPath":"/data"]}, | |
"ports": [{"containerPort": 4150}, | |
{"containerPort":4151}] | |
}] | |
} | |
}, | |
"labels": {"name": "nsqd"} | |
}}, | |
"labels": {"name": "nsqd"} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqlookupd-http", | |
"kind": "Service", | |
"apiVersion": "v1beta1", | |
"port": 14161, | |
"containerPort": 4161, | |
"protocol": "TCP", | |
"selector": { "name": "nsqlookupd" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqlookupd-tcp", | |
"kind": "Service", | |
"apiVersion": "v1beta1", | |
"port": 14160, | |
"containerPort": 4160, | |
"protocol": "TCP", | |
"selector": { "name": "nsqlookupd" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "nsqlookupdController", | |
"kind": "ReplicationController", | |
"apiVersion": "v1beta1", | |
"desiredState": { | |
"replicas": 3, | |
"replicaSelector": {"name": "nsqlookupd"}, | |
"podTemplate": { | |
"desiredState": { | |
"manifest": { | |
"version": "v1beta1", | |
"id": "nsqlookupdController", | |
"containers": [{ | |
"name": "nsqlookupd", | |
"image": "nsqio/nsqlookupd", | |
"ports": [{"containerPort": 4160}, | |
{"containerPort":4161}] | |
}] | |
} | |
}, | |
"labels": {"name": "nsqlookupd"} | |
}}, | |
"labels": {"name": "nsqlookupd"} | |
} |
Hey, I really don't get how this could work with several replicas. Could you explain how you managed to notify all the (3 replicas of) nslookupd when nsqd is starting?
Also pod IPs are considered ephemeral, what IP do the 5 replicas of nsqd register? If it's the ip of the service, what's the point of having nslookupd?
Finally, the 5 nsqd replicas are sharing a single PV, this will lead to io error as soon as 2 servers will write at the same place, how do you handle that?
Thanks for your insights.
Also found this:
https://github.com/tallstreet/nsq-kubernetes
I have not had a chance to try it.
use this instead
https://github.com/adrianchifor/k8s-nsq/blob/master/deploy.yaml
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
see @smreeds fork for updates to Kubernetes 0.5