9 changed files with 296 additions and 34 deletions
@ -0,0 +1,134 @@ |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
labels: |
|||
app: cassandra |
|||
name: cassandra |
|||
spec: |
|||
clusterIP: None |
|||
ports: |
|||
- port: 9042 |
|||
selector: |
|||
app: cassandra |
|||
--- |
|||
apiVersion: storage.k8s.io/v1beta1 |
|||
kind: StorageClass |
|||
metadata: |
|||
name: regular |
|||
provisioner: kubernetes.io/gce-pd |
|||
parameters: |
|||
type: pd-standard |
|||
--- |
|||
apiVersion: "apps/v1beta1" |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: cassandra |
|||
spec: |
|||
serviceName: cassandra |
|||
replicas: 3 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: cassandra |
|||
spec: |
|||
affinity: |
|||
podAntiAffinity: |
|||
requiredDuringSchedulingIgnoredDuringExecution: |
|||
- labelSelector: |
|||
matchExpressions: |
|||
- key: "app" |
|||
operator: In |
|||
values: |
|||
- cassandra |
|||
topologyKey: "kubernetes.io/hostname" |
|||
containers: |
|||
- name: cassandra |
|||
image: gcr.io/google-samples/cassandra:v12 |
|||
imagePullPolicy: Always |
|||
ports: |
|||
- containerPort: 7000 |
|||
name: intra-node |
|||
- containerPort: 7001 |
|||
name: tls-intra-node |
|||
- containerPort: 7199 |
|||
name: jmx |
|||
- containerPort: 9042 |
|||
name: cql |
|||
- containerPort: 9160 |
|||
name: thrift |
|||
resources: |
|||
limits: |
|||
cpu: "500m" |
|||
memory: 1Gi |
|||
requests: |
|||
cpu: "500m" |
|||
memory: 1Gi |
|||
securityContext: |
|||
capabilities: |
|||
add: |
|||
- IPC_LOCK |
|||
lifecycle: |
|||
preStop: |
|||
exec: |
|||
command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] |
|||
env: |
|||
- name: MAX_HEAP_SIZE |
|||
value: 512M |
|||
- name: HEAP_NEWSIZE |
|||
value: 100M |
|||
- name: CASSANDRA_SEEDS |
|||
value: "cassandra-0.cassandra.default.svc.cluster.local" |
|||
- name: CASSANDRA_CLUSTER_NAME |
|||
value: "K8Demo" |
|||
- name: CASSANDRA_DC |
|||
value: "DC1-K8Demo" |
|||
- name: CASSANDRA_RACK |
|||
value: "Rack1-K8Demo" |
|||
- name: CASSANDRA_AUTO_BOOTSTRAP |
|||
value: "false" |
|||
- name: POD_IP |
|||
valueFrom: |
|||
fieldRef: |
|||
fieldPath: status.podIP |
|||
- name: POD_NAMESPACE |
|||
valueFrom: |
|||
fieldRef: |
|||
fieldPath: metadata.namespace |
|||
readinessProbe: |
|||
exec: |
|||
command: |
|||
- /bin/bash |
|||
- -c |
|||
- /ready-probe.sh |
|||
initialDelaySeconds: 15 |
|||
timeoutSeconds: 5 |
|||
# These volume mounts are persistent. They are like inline claims, |
|||
# but not exactly because the names need to match exactly one of |
|||
# the stateful pod volumes. |
|||
volumeMounts: |
|||
- name: cassandra-data |
|||
mountPath: /cassandra_data |
|||
- name: cassandra-commitlog |
|||
mountPath: /cassandra_commitlog |
|||
# These are converted to volume claims by the controller |
|||
# and mounted at the paths mentioned above. |
|||
# do not use these in production until ssd GCEPersistentDisk or other ssd pd |
|||
volumeClaimTemplates: |
|||
- metadata: |
|||
name: cassandra-data |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: regular |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 2Gi |
|||
- metadata: |
|||
name: cassandra-commitlog |
|||
annotations: |
|||
volume.beta.kubernetes.io/storage-class: regular |
|||
spec: |
|||
accessModes: [ "ReadWriteOnce" ] |
|||
resources: |
|||
requests: |
|||
storage: 1Gi |
|||
@ -0,0 +1,22 @@ |
|||
apiVersion: v1 |
|||
kind: Pod |
|||
metadata: |
|||
name: tb-db-schema-deployment |
|||
spec: |
|||
containers: |
|||
- name: tb-db-schema-k8 |
|||
image: thingsboard/thingsboard-db-schema:k8test |
|||
env: |
|||
- name: SKIP_SCHEMA_CREATION |
|||
value: "false" |
|||
- name: SKIP_SYSTEM_DATA |
|||
value: "false" |
|||
- name : SKIP_DEMO_DATA |
|||
value: "false" |
|||
- name : CASSANDRA_URL |
|||
value: "cassandra" |
|||
command: |
|||
- sh |
|||
- -c |
|||
- ./install_schema.sh |
|||
restartPolicy: Never |
|||
@ -0,0 +1,105 @@ |
|||
--- |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: thingsboard-external |
|||
labels: |
|||
app: thingsboard-external |
|||
spec: |
|||
ports: |
|||
- port: 8080 |
|||
name: ui |
|||
- port: 1883 |
|||
name: mqtt |
|||
- port: 5683 |
|||
name: coap |
|||
- port: 9001 |
|||
name: rpc |
|||
selector: |
|||
app: thingsboard |
|||
type: LoadBalancer |
|||
--- |
|||
apiVersion: v1 |
|||
kind: Service |
|||
metadata: |
|||
name: thingsboard-headless |
|||
labels: |
|||
app: thingsboard-headless |
|||
spec: |
|||
ports: |
|||
- port: 8080 |
|||
name: ui |
|||
- port: 1883 |
|||
name: mqtt |
|||
- port: 5683 |
|||
name: coap |
|||
- port: 9001 |
|||
name: rpc |
|||
selector: |
|||
app: thingsboard |
|||
clusterIP: None |
|||
--- |
|||
apiVersion: v1 |
|||
kind: ConfigMap |
|||
metadata: |
|||
name: tb-config |
|||
data: |
|||
zookeeper.enabled: "true" |
|||
zookeeper.url: "zk-headless" |
|||
cassandra.url: "cassandra:9042" |
|||
--- |
|||
apiVersion: apps/v1beta1 |
|||
kind: StatefulSet |
|||
metadata: |
|||
name: tb |
|||
spec: |
|||
serviceName: "thingsboard-headless" |
|||
replicas: 2 |
|||
template: |
|||
metadata: |
|||
labels: |
|||
app: thingsboard |
|||
spec: |
|||
terminationGracePeriodSeconds: 10 |
|||
affinity: |
|||
podAntiAffinity: |
|||
requiredDuringSchedulingIgnoredDuringExecution: |
|||
- labelSelector: |
|||
matchExpressions: |
|||
- key: "app" |
|||
operator: In |
|||
values: |
|||
- thingsboard-headless |
|||
topologyKey: "kubernetes.io/hostname" |
|||
containers: |
|||
- name: thingsboard |
|||
image: thingsboard/application:k8test |
|||
ports: |
|||
- containerPort: 8080 |
|||
name: ui |
|||
- containerPort: 1883 |
|||
name: mqtt |
|||
- containerPort: 5683 |
|||
name: coap |
|||
- containerPort: 9001 |
|||
name: rpc |
|||
env: |
|||
- name: ZOOKEEPER_ENABLED |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: zookeeper.enabled |
|||
- name: ZOOKEEPER_URL |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: zookeeper.url |
|||
- name : CASSANDRA_URL |
|||
valueFrom: |
|||
configMapKeyRef: |
|||
name: tb-config |
|||
key: cassandra.url |
|||
command: |
|||
- sh |
|||
- -c |
|||
- ./run_thingsboard.sh |
|||
Loading…
Reference in new issue