From 6daf71565fd69e9ddb2ac20e787d49f74cf7a9d7 Mon Sep 17 00:00:00 2001 From: Nick Bartos Date: Tue, 5 Dec 2017 15:02:52 +1100 Subject: Contiv multi-master and other fixes Contiv's etcd was not being deployed correctly when using more than one master. To make it easier to manage, it has been moved into a k8s container. The api proxy was hardcoded to an old version (1.1.1), and in some environments would run into a docker error. This has been moved into a k8s container for easier management. The firewall was too permissive on several ports. Many were open to the world when they should have only been accessible inside the cluster. Many of the contiv role variables were not prefixed with 'contiv', which may end up clobbering variables from another role. Now all the contiv specific role variables start with 'contiv_'. The api proxy's default self-signed certificate was bundled with the role. This means someone with read-only MITM access and this key could decrypt traffic. Granted a user defined certificate from a trusted CA should be used in a production environment, it is still better to generate one in each environment when one is not provided. --- roles/contiv/templates/api-proxy-daemonset.yml.j2 | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 roles/contiv/templates/api-proxy-daemonset.yml.j2 (limited to 'roles/contiv/templates/api-proxy-daemonset.yml.j2') diff --git a/roles/contiv/templates/api-proxy-daemonset.yml.j2 b/roles/contiv/templates/api-proxy-daemonset.yml.j2 new file mode 100644 index 000000000..4d4388706 --- /dev/null +++ b/roles/contiv/templates/api-proxy-daemonset.yml.j2 @@ -0,0 +1,56 @@ +--- +apiVersion: extensions/v1beta1 +kind: DaemonSet +metadata: + name: contiv-api-proxy + namespace: kube-system +spec: + updateStrategy: + type: RollingUpdate + selector: + matchLabels: + name: contiv-api-proxy + template: + metadata: + namespace: kube-system + labels: + name: contiv-api-proxy + annotations: + scheduler.alpha.kubernetes.io/critical-pod: "" + spec: + serviceAccountName: contiv-api-proxy + hostNetwork: true + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/hostname + operator: In + values: +{% for node in groups.oo_masters_to_config %} + - "{{ node }}" +{% endfor %} + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule + containers: + - name: contiv-api-proxy + image: "{{ contiv_api_proxy_image_repo }}:{{ contiv_version }}" + args: + - "--listen-address=0.0.0.0:{{ contiv_api_proxy_port }}" + - --tls-key-file=/var/contiv/api_proxy_key.pem + - --tls-certificate=/var/contiv/api_proxy_cert.pem + - "--data-store-address={{ etcd_host }}" + - "--netmaster-address=127.0.0.1:{{ contiv_netmaster_port }}" + ports: + - containerPort: "{{ contiv_api_proxy_port }}" + hostPort: "{{ contiv_api_proxy_port }}" + volumeMounts: + - name: secret-volume + mountPath: /var/contiv + readOnly: true + volumes: + - name: secret-volume + secret: + secretName: contiv-api-proxy-secret -- cgit v1.2.3 From a6860728cf634fdcba82db9dd5b2a2d82e93eaca Mon Sep 17 00:00:00 2001 From: Nick Bartos Date: Tue, 19 Dec 2017 11:45:23 +1100 Subject: Use Contiv version 1.2.0 --- roles/contiv/templates/api-proxy-daemonset.yml.j2 | 1 + 1 file changed, 1 insertion(+) (limited to 'roles/contiv/templates/api-proxy-daemonset.yml.j2') diff --git a/roles/contiv/templates/api-proxy-daemonset.yml.j2 b/roles/contiv/templates/api-proxy-daemonset.yml.j2 index 4d4388706..a15073580 100644 --- a/roles/contiv/templates/api-proxy-daemonset.yml.j2 +++ b/roles/contiv/templates/api-proxy-daemonset.yml.j2 @@ -42,6 +42,7 @@ spec: - --tls-key-file=/var/contiv/api_proxy_key.pem - --tls-certificate=/var/contiv/api_proxy_cert.pem - "--data-store-address={{ etcd_host }}" + - --data-store-driver=etcd - "--netmaster-address=127.0.0.1:{{ contiv_netmaster_port }}" ports: - containerPort: "{{ contiv_api_proxy_port }}" -- cgit v1.2.3