Skip to content

Instantly share code, notes, and snippets.

@tsunammis
Created December 11, 2015 10:10
Show Gist options
  • Save tsunammis/7731d1c4aecb0d86977e to your computer and use it in GitHub Desktop.
Save tsunammis/7731d1c4aecb0d86977e to your computer and use it in GitHub Desktop.
Cluster of NSQ on Kubernetes for multiple hosts (kubernetes.io)
apiVersion: v1
kind: ReplicationController
metadata:
name: nsq
spec:
replicas: 4
selector:
name: nsq
template:
metadata:
labels:
name: nsq
spec:
containers:
- name: nsq
image: nsqio/nsq
command: ["sh", "-c", "nsqd --lookupd-tcp-address=nsqlookupd.default.svc.cluster.local:4160 --broadcast-address=$(hostname -i)"]
ports:
- containerPort: 4150
name: tcp
protocol: TCP
- containerPort: 4151
name: http
protocol: TCP
apiVersion: v1
kind: ReplicationController
metadata:
name: nsqadmin
spec:
replicas: 1
selector:
name: nsqadmin
template:
metadata:
labels:
name: nsqadmin
spec:
containers:
- name: nsqadmin
image: nsqio/nsq
command: ["nsqadmin", "--lookupd-http-address=nsqlookupd.default.svc.cluster.local:4161"]
ports:
- containerPort: 4171
apiVersion: v1
kind: Service
metadata:
name: nsqadmin
labels:
name: nsqadmin
spec:
type: LoadBalancer
ports:
- port: 4171
targetPort: 4171
protocol: TCP
name: http
selector:
name: nsqadmin
apiVersion: v1
kind: ReplicationController
metadata:
name: nsqlookupd
spec:
replicas: 1
selector:
name: nsqlookupd
template:
metadata:
labels:
name: nsqlookupd
spec:
containers:
- name: nsqlookupd
image: nsqio/nsq
command: ["nsqlookupd"]
ports:
- containerPort: 4160
name: tcp
protocol: TCP
- containerPort: 4161
name: http
protocol: TCP
apiVersion: v1
kind: Service
metadata:
name: nsqlookupd
labels:
name: nsqlookupd
spec:
type: LoadBalancer
ports:
- port: 4160
name: tcp
targetPort: 4160
- port: 4161
name: http
targetPort: 4161
selector:
name: nsqlookupd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment