| ################################################################################ |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| ################################################################################ |
| |
| --- |
| apiVersion: v1 |
| kind: ConfigMap |
| metadata: |
| name: influxdb-init-scripts |
| data: |
| init-script.iql: | |
| CREATE RETENTION POLICY "a_year" ON "beam_test_metrics" DURATION 52w REPLICATION 1 DEFAULT |
| CREATE RETENTION POLICY "forever" ON "beam_test_metrics" DURATION INF REPLICATION 1 |
| --- |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| labels: |
| app: beammetrics |
| name: influxdb |
| spec: |
| replicas: 1 |
| selector: |
| matchLabels: |
| app: influxdb |
| template: |
| metadata: |
| labels: |
| app: influxdb |
| spec: |
| containers: |
| - image: influxdb:1.8.0 |
| imagePullPolicy: IfNotPresent |
| name: influxdb |
| ports: |
| - containerPort: 8086 |
| - containerPort: 8088 |
| volumeMounts: |
| - mountPath: /var/lib/influxdb |
| name: influxdb-storage |
| - mountPath: /docker-entrypoint-initdb.d |
| name: influxdb-init-scripts |
| readOnly: True |
| env: |
| # Default database name. Influx will create a new database with that |
| # name if it does not exist. |
| - name: INFLUXDB_DB |
| value: beam_test_metrics |
| # Enable user authentication. Note: InfluxDB will NOT enforce |
| # authentication if there is no admin user. |
| - name: INFLUXDB_HTTP_AUTH_ENABLED |
| value: "true" |
| # Expose the port 8088 to allow backing up and restoring database |
| # from another container. |
| - name: INFLUXDB_BIND_ADDRESS |
| value: ":8088" |
| envFrom: |
| # A generic secret that should contain the following keys: |
| # * `INFLUXDB_ADMIN_USER` - The name of the admin user to be created. |
| # * `INFLUXDB_ADMIN_PASSWORD` |
| # * `INFLUXDB_USER` - The name of a user to be created. The user will |
| # be granted read and write permissions for a database specified |
| # in `INFLUXDB_DB` |
| # * `INFLUXDB_USER_PASSWORD` |
| - secretRef: |
| name: influxdb-creds |
| restartPolicy: Always |
| volumes: |
| - name: influxdb-storage |
| persistentVolumeClaim: |
| claimName: influxdb-storage |
| - name: influxdb-init-scripts |
| configMap: |
| name: influxdb-init-scripts |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: influxdb |
| # Makes the service accessible to Compute Engine VM instances running in |
| # the same region on the same VPC network. |
| # |
| # For more information, see: |
| # https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing |
| annotations: |
| cloud.google.com/load-balancer-type: "Internal" |
| spec: |
| type: LoadBalancer |
| ports: |
| - port: 8086 |
| targetPort: 8086 |
| selector: |
| app: influxdb |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: influxdb-rpc |
| spec: |
| ports: |
| - port: 8088 |
| targetPort: 8088 |
| selector: |
| app: influxdb |