在Google Cloud platform上的Kubernetes集群部署HANA Express

2021-04-09 15:28

阅读:635

标签:技术   nis   deploy   col   clust   city   vol   cto   ati   

在Google Cloud platform的Kubernetes cluster上,新建一个hxe.yaml文件:

技术图片

将如下内容拷贝进yaml文件:

kind: ConfigMap
apiVersion: v1
metadata:
  creationTimestamp: 2018-01-18T19:14:38Z
  name: hxe-pass
data:
  password.json: |+
    {"master_password" : "HXEHana1"}
---
kind: PersistentVolume
apiVersion: v1
metadata:
  name: persistent-vol-hxe
  labels:
    type: local
spec:
  storageClassName: manual
  capacity:
    storage: 150Gi
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/data/hxe_pv"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: hxe-pvc
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hxe
  labels:
    name: hxe
spec:
  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"
        ports:
        - containerPort: 3000

---
apiVersion: v1
kind: Service
metadata:
  name: hxe-connect
  labels:
    app: hxe
spec:
  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
  selector:
    app: hxe
---
apiVersion: v1
kind: Service
metadata:
  name: sqlpad
  labels:
    app: hxe
spec:
  type: LoadBalancer
  ports:
  - port: 3000
    targetPort: 3000
    protocol: TCP
    name: sqlpad
  selector:
    app: hxe

技术图片

第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

技术图片

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
技术图片

在Google Cloud platform上的Kubernetes集群部署HANA Express

标签:技术   nis   deploy   col   clust   city   vol   cto   ati   

原文地址:https://www.cnblogs.com/sap-jerry/p/12444215.html


评论


亲,登录后才可以留言!