apiVersion: v1 kind: Secret metadata: name: hive-metastore-db-secrets type: Opaque data: hive-metastore-db-root-password: {{ .Values.hive.metastore_db_root_password | b64enc }} hive-metastore-db-user: {{ .Values.hive.metastore_db_user | b64enc }} hive-metastore-db-password: {{ .Values.hive.metastore_db_password | b64enc }} hive-metastore-db-name: {{ .Values.hive.metastore_db_name | b64enc }} --- apiVersion: v1 kind: Service metadata: name: hive spec: selector: hadoop: hive ports: - protocol: TCP port: 3306 targetPort: 3306 name: a - protocol: TCP port: 9083 targetPort: 9083 name: b --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: hadoop: hive name: hive namespace: default spec: replicas: 1 selector: matchLabels: hadoop: hive template: metadata: labels: hadoop: hive spec: restartPolicy: Always containers: - image: mysql:5.7 imagePullPolicy: Always name: mysql resources: {} env: - name: MYSQL_ROOT_PASSWORD valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-root-password - name: MYSQL_USER value: metastore - name: MYSQL_PASSWORD valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-password - name: MYSQL_DATABASE valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-name - image: {{ .Values.registry }}/hive-server:{{ .Values.hive.tag }} imagePullPolicy: Always name: hive-server resources: {} command: ['bash', '-c', '/opt/hive/init.sh; hive --service metastore --hiveconf hive.root.logger=INFO,console'] env: - name: MYSQL_USER valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-user - name: MYSQL_PASSWORD valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-password - name: MYSQL_DATABASE valueFrom: secretKeyRef: name: hive-metastore-db-secrets key: hive-metastore-db-name volumes: - name: hive-metastore-mysql hostPath: path: /tmp/hive-metastore-mysql2