0

I have the following jps manifest:

jpsVersion: 1.3
jpsType: install
application:
  id: my-app
  name: My App
  version: 0.0

  settings:
    fields:
    - name: envName
      caption: Env Name
      type: string
      required: true
    - name: topo
      type: radio-fieldset
      values:
        0-dev: '<b>Development:</b> one master (1) and one scalable worker (1+)'
        1-prod: '<b>Production:</b> multi master (3) with API balancers (2+) and scalable workers (2+)'
      default: 0-dev
    - name: k8s-version
      type: string
      caption: k8s manifest version
      default: v1.16.3

  onInstall:
  - installKubernetes

  actions:
    installKubernetes:
      install:
        jps: https://github.com/jelastic-jps/kubernetes/blob/${settings.k8s-version}/manifest.jps
        envName: ${settings.envName}
        displayName: ${settings.envName}
        settings:
          deploy: cc
          topo: ${settings.topo}
          dashboard: version2
          ingress-controller: Nginx
          storage: true
          api: true
          monitoring: true
          version: ${settings.k8s-version}
          jaeger: false

Now, I'd like to add a load balancer in front of the k8s cluster, something like

  env:
    topology:
      nodes:
      - nodeGroup: bl
        nodeType: nginx-dockerized
        tag: 1.16.1
        displayName: Node balancing
        count: 1
        fixedCloudlets: 1
        cloudlets: 4

Of course, the above kubernetes jps installation creates a topology. Therefore, there is no way I can call the above env section. How can I add a new node to the topology created by the jelastic kubernetes jps? I found addNodes, but it does not seem to allow to define what comes into the bl node group.

In the Jelastic API, I was able to find the EditNodeGroup method, which I believe would solve my problem. However, the documentation is not very clear, it's kind of missing an example from which I could guess how to fill up the parameters. How do I use that method to add an nginx load balancer to my k8s environment?

EDIT

The EditNodeGroup method is of no use for that problem. I think, currently, my best option is to fork the jelastic-jps/kubernetes and adapt the beforeinstall for my needs. Do I have any other option? I browsed the API and found no way to add my nginx load balancer.

Laurent Michel
  • 1,069
  • 3
  • 14
  • 29

1 Answers1

0

The environment topology cannot be changed during an external manifest invocation, since it's created within that manifest. But it can be altered after the manifest finish. The whole approach is:

onInstall:
  - installKubernetes
  - addBalancer
actions:
  installKubernetes:
    install:
      jps: https://github.com/jelastic-jps/kubernetes/blob/${settings.k8s-version}/manifest.jps
      envName: ${settings.envName}
...
  addBalancer:
    - install:
        envName: ${settings.envName}
        jps:
          type: update
          name: Add Balancer Node
          onInstall:
            - addNodes:
....

Please refer https://github.com/jelastic-jps/kubernetes/blob/ad62208a5b3796bb7beeaedfce5c42b18512d9f0/addons/storage.jps example on how to use "addNodes" action in the manifest.

Also, the reference https://docs.cloudscripting.com/creating-manifest/actions/#addnodes describes all fields that can be used.

The latest published version of K8s for Jelastic is: v1.16.6, so you could use it in your manifest.

But, please note, that via this Balancer instance you will be accessing the default Kubernetes ingress controller, i.e. the same ingresses/paths that you currently have at "http(s)://".

Of course, you can assign a public ip to added BL, and access the same functionality not via Shared Balancers as before, but via public IP from now on.

In a nutshell, Jelastic Balancer instance currently doesn't provide a Kubernetes service LoadBalancer functionality — if you need exactly this one. The K8S LoadBalancer functionality will be added in the next release: public IPs added to "cp" worker can be automatically used for LoadBalancers created inside the Kubernetes cluster. We expect this functionality be added to 1.16.8+

Please let us know if you have any further questions.

Virtuozzo
  • 1,993
  • 1
  • 10
  • 13