Richard Jankowski | e585808 | 2018-01-15 18:25:38 -0500 | [diff] [blame] | 1 | apiVersion: v1 |
| 2 | kind: Service |
| 3 | metadata: |
| 4 | name: zoo1 |
| 5 | spec: |
| 6 | clusterIP: None |
| 7 | selector: |
| 8 | app: zookeeper-1 |
| 9 | ports: |
| 10 | - name: client |
| 11 | port: 2181 |
| 12 | targetPort: 2181 |
| 13 | - name: follower |
| 14 | port: 2888 |
| 15 | targetPort: 2888 |
| 16 | - name: leader |
| 17 | port: 3888 |
| 18 | targetPort: 3888 |
| 19 | --- |
| 20 | apiVersion: v1 |
| 21 | kind: Service |
| 22 | metadata: |
| 23 | name: zoo2 |
| 24 | spec: |
| 25 | clusterIP: None |
| 26 | selector: |
| 27 | app: zookeeper-2 |
| 28 | ports: |
| 29 | - name: client |
| 30 | port: 2181 |
| 31 | targetPort: 2181 |
| 32 | - name: follower |
| 33 | port: 2888 |
| 34 | targetPort: 2888 |
| 35 | - name: leader |
| 36 | port: 3888 |
| 37 | targetPort: 3888 |
| 38 | --- |
| 39 | apiVersion: v1 |
| 40 | kind: Service |
| 41 | metadata: |
| 42 | name: zoo3 |
| 43 | spec: |
| 44 | clusterIP: None |
| 45 | selector: |
| 46 | app: zookeeper-3 |
| 47 | ports: |
| 48 | - name: client |
| 49 | port: 2181 |
| 50 | targetPort: 2181 |
| 51 | - name: follower |
| 52 | port: 2888 |
| 53 | targetPort: 2888 |
| 54 | - name: leader |
| 55 | port: 3888 |
| 56 | targetPort: 3888 |
| 57 | --- |
| 58 | apiVersion: apps/v1beta1 |
| 59 | kind: StatefulSet |
| 60 | metadata: |
| 61 | name: zookeeper1 |
| 62 | spec: |
| 63 | serviceName: zoo1 |
| 64 | replicas: 1 |
| 65 | selector: |
| 66 | matchLabels: |
| 67 | app: zookeeper-1 |
| 68 | template: |
| 69 | metadata: |
| 70 | labels: |
| 71 | app: zookeeper-1 |
| 72 | spec: |
| 73 | containers: |
| 74 | - name: zoo1 |
| 75 | image: zookeeper:3.4.11 |
| 76 | ports: |
| 77 | - containerPort: 2181 |
| 78 | - containerPort: 2888 |
| 79 | - containerPort: 3888 |
| 80 | env: |
| 81 | - name: NAMESPACE |
| 82 | valueFrom: |
| 83 | fieldRef: |
| 84 | fieldPath: metadata.namespace |
| 85 | - name: ZOO_MY_ID |
| 86 | value: "1" |
| 87 | - name: ZOO_SERVERS |
| 88 | value: > |
| 89 | server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 90 | server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 91 | server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 92 | --- |
| 93 | apiVersion: apps/v1beta1 |
| 94 | kind: StatefulSet |
| 95 | metadata: |
| 96 | name: zookeeper2 |
| 97 | spec: |
| 98 | serviceName: zoo2 |
| 99 | replicas: 1 |
| 100 | selector: |
| 101 | matchLabels: |
| 102 | app: zookeeper-2 |
| 103 | template: |
| 104 | metadata: |
| 105 | labels: |
| 106 | app: zookeeper-2 |
| 107 | spec: |
| 108 | containers: |
| 109 | - name: zoo2 |
| 110 | image: zookeeper:3.4.11 |
| 111 | ports: |
| 112 | - containerPort: 2181 |
| 113 | - containerPort: 2888 |
| 114 | - containerPort: 3888 |
| 115 | env: |
| 116 | - name: NAMESPACE |
| 117 | valueFrom: |
| 118 | fieldRef: |
| 119 | fieldPath: metadata.namespace |
| 120 | - name: ZOO_MY_ID |
| 121 | value: "2" |
| 122 | - name: ZOO_SERVERS |
| 123 | value: > |
| 124 | server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 125 | server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 126 | server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 127 | --- |
| 128 | apiVersion: apps/v1beta1 |
| 129 | kind: StatefulSet |
| 130 | metadata: |
| 131 | name: zookeeper3 |
| 132 | spec: |
| 133 | serviceName: zoo3 |
| 134 | replicas: 1 |
| 135 | selector: |
| 136 | matchLabels: |
| 137 | app: zookeeper-3 |
| 138 | template: |
| 139 | metadata: |
| 140 | labels: |
| 141 | app: zookeeper-3 |
| 142 | spec: |
| 143 | containers: |
| 144 | - name: zoo3 |
| 145 | image: zookeeper:3.4.11 |
| 146 | ports: |
| 147 | - containerPort: 2181 |
| 148 | - containerPort: 2888 |
| 149 | - containerPort: 3888 |
| 150 | env: |
| 151 | - name: NAMESPACE |
| 152 | valueFrom: |
| 153 | fieldRef: |
| 154 | fieldPath: metadata.namespace |
| 155 | - name: ZOO_MY_ID |
| 156 | value: "3" |
| 157 | - name: ZOO_SERVERS |
| 158 | value: > |
| 159 | server.1=zookeeper1-0.zoo1.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 160 | server.2=zookeeper2-0.zoo2.$(NAMESPACE).svc.cluster.local:2888:3888 |
| 161 | server.3=zookeeper3-0.zoo3.$(NAMESPACE).svc.cluster.local:2888:3888 |