Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
Revamp NATS deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Paulo Pires <pjpires@gmail.com>
  • Loading branch information
pires committed Dec 17, 2017
1 parent 1b0869f commit e3c9e04
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 104 deletions.
50 changes: 0 additions & 50 deletions deployment-tls.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions deployment.yaml

This file was deleted.

62 changes: 62 additions & 0 deletions nats.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
listen: 0.0.0.0:4242
http: 0.0.0.0:8222

tls {
cert_file: "/etc/nats/tls/nats.pem"
key_file: "/etc/nats/tls/nats-key.pem"
timeout: 2
}

# Authorization for client connections
authorization {
user: nats_client_user
# ./util/mkpasswd -p T0pS3cr3t
password: nats_client_pwd
timeout: 1
}

# Cluster definition
cluster {
listen: 0.0.0.0:6222

tls {
cert_file: "/etc/nats/tls/nats.pem"
key_file: "/etc/nats/tls/nats-key.pem"
ca_file: "/etc/nats/tls/ca.pem"
timeout: 2
}

# Authorization for route connections
authorization {
user: nats_route_user
password: nats_route_pwd
timeout: 0.5
}

# Routes are actively solicited and connected to from this server.
# Other servers can connect to us if they supply the correct credentials
# in their routes definitions from above.
routes = [
nats://nats_route_user:nats_route_pwd@nats:6222
]
}

# logging options
debug: false
trace: true
logtime: true

# Some system overides

# max_connections
max_connections: 100

# maximum protocol control line
max_control_line: 512

# maximum payload
max_payload: 65536

# Duration the server can block on a socket write to a client. Exceeding the
# deadline will designate a client as a slow consumer.
write_deadline: "2s"
71 changes: 71 additions & 0 deletions nats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
apiVersion: v1
kind: Service
metadata:
name: nats
labels:
component: nats
spec:
selector:
component: nats
clusterIP: None
ports:
- name: client
port: 4222
- name: cluster
port: 6222
- name: monitor
port: 8222
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: nats
labels:
component: nats
spec:
serviceName: nats
replicas: 3
template:
metadata:
labels:
component: nats
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: component
operator: In
values:
- nats
topologyKey: kubernetes.io/hostname
containers:
- name: nats
image: nats:1.0.4
args: [ "--config", "/etc/nats/nats.conf"]
volumeMounts:
- name: tls-volume
mountPath: /etc/nats/tls
- name: config-volume
mountPath: /etc/nats
ports:
- containerPort: 4222
name: client
- containerPort: 6222
name: cluster
- containerPort: 8222
name: monitor
livenessProbe:
httpGet:
path: /
port: 8222
initialDelaySeconds: 10
timeoutSeconds: 5
volumes:
- name: tls-volume
secret:
secretName: tls-nats-server
- name: config-volume
configMap:
name: nats-config
17 changes: 0 additions & 17 deletions svc.yaml

This file was deleted.

0 comments on commit e3c9e04

Please sign in to comment.