在Google Cloud platform的
Kubernetescluster上,新建一个hxe.yaml文件:
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5iZllzNkVmYwEGZmJjYzImY1UGZ0gjYiVWM2MGOlJmNm9CX5d2bs92Yl1iclB3bsVmdlR2LcNWaw9CXt92Yu4GZjlGbh5yYjV3Lc9CX6MHc0RHaiojIsJye.png)
将如下内容拷贝进yaml文件:
kind: ConfigMap
apiVersion: v1
metadata:
creationTimestamp: 2018-01-18T19:14:38Z
name: hxe-pass
data:
password.json: |+
{"master_password" : "HXEHana1"}
---
kind: PersistentVolume
name: persistent-vol-hxe
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 150Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/data/hxe_pv"
kind: PersistentVolumeClaim
name: hxe-pvc
resources:
requests:
storage: 50Gi
apiVersion: apps/v1
kind: Deployment
name: hxe
name: hxe
selector:
matchLabels:
run: hxe
app: hxe
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
run: hxe
app: hxe
role: master
tier: backend
spec:
initContainers:
- name: install
image: busybox
command: [ 'sh', '-c', 'chown 12000:79 /hana/mounts' ]
volumeMounts:
- name: hxe-data
mountPath: /hana/mounts
volumes:
- name: hxe-data
persistentVolumeClaim:
claimName: hxe-pvc
- name: hxe-config
configMap:
name: hxe-pass
imagePullSecrets:
- name: docker-secret
containers:
- name: hxe-container
image: "store/saplabs/hanaexpress:2.00.033.00.20180925.2"
ports:
- containerPort: 39013
name: port1
- containerPort: 39015
name: port2
- containerPort: 39017
name: port3
- containerPort: 8090
name: port4
- containerPort: 39041
name: port5
- containerPort: 59013
name: port6
args: [ "--agree-to-sap-license", "--dont-check-system", "--passwords-url", "file:///hana/hxeconfig/password.json" ]
volumeMounts:
- name: hxe-data
mountPath: /hana/mounts
- name: hxe-config
mountPath: /hana/hxeconfig
- name: sqlpad-container
image: "sqlpad/sqlpad"
- containerPort: 3000
kind: Service
name: hxe-connect
app: hxe
type: LoadBalancer
ports:
- port: 39013
targetPort: 39013
name: port1
- port: 39015
targetPort: 39015
name: port2
- port: 39017
targetPort: 39017
name: port3
- port: 39041
targetPort: 39041
name: port5
name: sqlpad
- port: 3000
targetPort: 3000
protocol: TCP
name: sqlpad
第77行指定了HANA
express对应的容器镜像文件:
“store/saplabs/hanaexpress:2.00.033.00.20180925.2”
使用命令行创建资源:
kubectl create -f hxe.yaml:
创建成功,使用命令行kubectl describe pods查看成功创建的资源:
使用命令行查看数据库是否成功启动:
kubectl logs deployment/hxe -c hxe-container
看到startup finished的消息,说明启动成功:
使用命令行进入pod内部,得到shell:
kubectl exec -it <> bash
打开SQL console:
hdbsql -i 90 -d systemdb -u SYSTEM -p HXEHana1