VOL-569: Create kubernetes deployment configuration for each voltha service
This update:
- organizes all Voltha components under their own namespace, "voltha". If
you have a script for deploying Voltha, then add namespace.yml at the top.
- adds host volume mounts for Consul's data and config directories
- fixes a bug in Envoy where it was aborting because it couldn't find Consul
even though it was getting the Voltha assignments from Etcd.
Change-Id: I45eaf2d65428c0184df06971ce3797b9122d3055
diff --git a/k8s/consul.yml b/k8s/consul.yml
index 34b1fc8..b398b7a 100644
--- a/k8s/consul.yml
+++ b/k8s/consul.yml
@@ -2,6 +2,7 @@
kind: Service
metadata:
name: consul
+ namespace: voltha
labels:
name: consul
spec:
@@ -46,6 +47,7 @@
kind: StatefulSet
metadata:
name: consul
+ namespace: voltha
spec:
serviceName: consul
replicas: 3
@@ -70,27 +72,30 @@
containers:
- name: consul
image: "consul:0.9.2"
+ volumeMounts:
+ - name: consul-config
+ mountPath: /consul/config
+ - name: consul-data
+ mountPath: /consul/data
env:
- - name: POD_IP
- valueFrom:
- fieldRef:
- fieldPath: status.podIP
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- "agent"
- - "-bind=0.0.0.0"
+ - "-server"
- "-bootstrap-expect=3"
+ - "-config-dir=/consul/config"
+ - "-data-dir=/consul/data"
+ - "-bind=0.0.0.0"
+ - "-client=0.0.0.0"
+ - "-ui"
+ - "-raft-protocol=3"
+ - "-rejoin"
- "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
- "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
- "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
- - "-client=0.0.0.0"
- - "-config-dir=/consul/config"
- - "-data-dir=/consul/data"
- - "-server"
- - "-ui"
lifecycle:
preStop:
exec:
@@ -117,3 +122,12 @@
name: consuldns
- containerPort: 8300
name: server
+ volumes:
+ - name: consul-config
+ hostPath:
+ path: /cord/incubator/voltha/consul/config
+ type: Directory
+ - name: consul-data
+ hostPath:
+ path: /cord/incubator/voltha/consul/data
+ type: Directory