Step 1: Create configmap for API AutoFlow system configuration (autoflow.conf) and solution configuration (config.json):

kubectl create configmap autoflow-config --from-file=autoflow.conf --dry-run -o yaml | kubectl apply -f -

kubectl create configmap autoflow-json --from-file=config.json --dry-run -o yaml | kubectl apply -f -

Step 2: Create a deployment YAML manifest file (deployment.config) like below:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-autoflow-deployment
spec:
  selector:
    matchLabels:
      app: api-autoflow-deployment
  replicas: 1
  template:
    metadata:
      labels:
        app: api-autoflow-deployment
    spec:
      containers:
        - name: api-autoflow-deployment
          image: interactor/api-autoflow:latest
          command: [ "/bin/bash", "-c", "--" ]
          volumeMounts:
            - name: autoflow-config
              mountPath: /etc/autoflow-config
            - name: autoflow-json
              mountPath: /etc/autoflow-json
          args: [ "mkdir /app/data; cp /etc/autoflow-config/autoflow.conf /app/data/autoflow.conf; /app/bin/api_interactor start; while true; do sleep 30; done;" ]
          ports:
          - containerPort: 4000 # configured API AutoFlow UI port (default 4000)
            protocol: TCP
          - containerPort: 4001 # configured API server port
            protocol: TCP
      volumes:
        - name: autoflow-config
          configMap:
            name: autoflow-config
        - name: autoflow-json
          configMap:
            name: autoflow-json
---
apiVersion: v1
kind: Service
metadata:
  name: api-autoflow-deployment-lb
  labels:
    app: api-autoflow-deployment
spec:
  type: LoadBalancer
  ports:
    - name: ui
      protocol: TCP
      port: 4000
      targetPort: 4000
    - name: data
      protocol: TCP
      port: 4001
      targetPort: 4001
  selector:
    app: api-autoflow-deployment

Step 3: Deploy

kubectl apply -f deployment.config

Step 4: Open up the browser and go to following URL

http://localhost:4000

Leave a Reply