Skip to content

Instantly share code, notes, and snippets.

@TheConnMan
Last active February 11, 2018 00:13
Show Gist options
  • Save TheConnMan/544db879d81cb2db5088e68e35230c9b to your computer and use it in GitHub Desktop.
Save TheConnMan/544db879d81cb2db5088e68e35230c9b to your computer and use it in GitHub Desktop.
Kubernetes SkyRing
listen: 0.0.0.0:4222
http: 0.0.0.0:8222
# Cluster definition
cluster {
listen: 0.0.0.0:6222
# 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: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"
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/config/nats.conf"]
volumeMounts:
- name: config-volume
mountPath: /etc/nats/config
ports:
- containerPort: 4222
name: client
- containerPort: 6222
name: cluster
- containerPort: 8222
name: monitor
livenessProbe:
httpGet:
path: /
port: 8222
initialDelaySeconds: 10
timeoutSeconds: 5
volumes:
- name: config-volume
configMap:
name: nats-config
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: skyring
spec:
replicas: 3
template:
metadata:
labels:
app: skyring
spec:
hostname: skyring
containers:
- name: skyring
image: 'quay.io/esatterwhite/skyring:5-latest'
ports:
- containerPort: 3455
- containerPort: 3000
env:
- name: nats__hosts
value: nats:4222
- name: seeds
value: skyring-service:3455
- name: DEBUG
value: '*'
- name: storage__backend
value: leveldown
- name: storage__path
value: /var/data/skyring
- name: channel__host
value: skyring
---
apiVersion: v1
kind: Service
metadata:
name: skyring-service
labels:
name: skyring-service
spec:
ports:
- port: 80
targetPort: 3000
protocol: TCP
name: client
selector:
app: skyring
type: LoadBalancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment