Skip to Content

About two months ago, I visited the Google office in San Francisco to collaborate on the new Google Cloud + SAP CodeJam materials.

A lot of great content happened in the meantime and, while collaborating, I wanted to test our integrations with my deployments on the Google Kubernetes Engine, for the fun of it and because who does not get inspired by an endless free supply of frozen yoghurt:

I cannot share the FroYo with you, but I’m hoping the GIF inspires you to try this out too.

Taking  Craig Cmehil’s idea to use SQLPAD on top of HXE, I added it to my deployment of SAP HANA, express edition in Kubernetes. This builds on top of the original tutorial on how to deploy HANA Express on Google Kubernetes Engine.

 

Deploying HANA Express and SQLPAD in Google Kubernetes Engine

First things first, please take note of the version:

 

The additions to the original yaml file are very simple and I think this is awesome:

  • 1 more container in the deployment
  • A new service to expose the ports in SQLPAD

And here is the file I am using (I am copying the full file as I may not necessarily come back to this blog post if I update the tutorial).

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.030.00.20180403.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

Connecting to your SQLPAD container

The ports to connect using another client are still open to the outside world because of the service of type LoadBalancer. Check on the services and you can see SQLPAD also got its own external IP address:

Using that in a browser…. Ta-da! A SQL client!

You need to sign up first, then log in and then you can proceed to add a connection:

(Remember, the port for default tenant in the Docker container is 39041 )

Test, save and go into New Query:

 

Of course, you can do this in other Kubernetes orchestrating platforms. Let’s connect on Twitter or LinkedIn, I would love to know how this goes and what you come up with.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply