Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In PPaaS, the backend members in the instances, such as in a Virtual Machine (VM) setup the VM instances and in a Kubernetes setup the Docker instances, are fronted by a Load Balancer with the use of proxies. The proxyPort property is used to define the port of the Load Balancer. When the Load Balancer receives application traffic, it will route the traffic to the members (worker nodes) in the respective clusters, based on their resource availability.

...

Note

Anchor
pre
pre
The URL to access a service depends on the port mapping (VM) and port range (Docker) that you defined in the cartridge definition and the Kubernetes cluster definition respectively.

Expand
titleClick here for more information...

When creating the dependent artifacts that are needed to deploy an application, you need to define port mapping , in the cartridge definition JSON , for each port that will be is being used with the WSO2 product cartridge. 
The following examples illustrate how to set unique proxy ports can be set for ports each port that are is used with the cartridge.

Localtabgroup
Localtab
activetrue
titleEC2
Code Block
titleExample for defining proxyPort proxy ports in Cartridge the cartridge definition
 "portMapping": [
        {
            "name": "mgt-http",
            "protocol": "http",
            "port": 9763,
            "proxyPort": 80
        },
        {
            "name": "mgt-https",
            "protocol": "https",
            "port": 9443,
            "proxyPort": 443
        }
    ],
Localtab
titleKubernetes
Code Block
titleExample for defining proxyPort proxy ports in the Cartridge definition
 "portMapping": [
        {
            "name": "mgt-http",
            "protocol": "http",
            "port": 9763,
            "proxyPort": 0,
            "kubernetesPortType": "NodePort"
        },
        {
            "name": "mgt-https",
            "protocol": "https",
            "port": 9443,
            "proxyPort": 0,
            "kubernetesPortType": "NodePort"
        }
    ],
  • kubernetesPortType - The Kubernetes port type to which the cartridge is mapped.

    Info

    The following can be assigned for the Kubernetes port type:

    • NodePort -  If this value is used, it will create a service which can be accessed from the outside with port range of 30,000 to 32,767.
    • ClusterIP - If this value is used, the service that gets created will not be exposed to the outside. This is useful if you don't want to expose a service to outside, but need to maintain internal communication within Docker containers.

    Access URLs are generated only for the NodePort service type.

     

Code Block
titleDefining the portRange in the Kubernetes cluster definition
 "portRange": {
        "upper": "32767",
        "lower": "30000"
    },
  1. Identify the Load Balancer IP and the hostname of the each of the clusters that are available in the deployed application.
    For more information, see Getting the Runtime Topology of an Application.

  2. Anchor
    step2
    step2
    Map the cluster hostname with one of the Load Balancer IPs.
    Each Load Balancer IP refers to the IP of a node. 

    1. Open the /etc/hosts/ file.
      Example:
      If you are using Vim, which is a text editor, you can open the file in the terminal as follows:

      Code Block
      vim /etc/hosts/
    2. Define mapping for Map all the hostnames against the available LB IPs in the /etc/hosts/ file and save the file.
      <LB_IP> <HOSTNAME> 
      Example:

      Code Block
      172.17.8.103 wso2as-521-application.mgt.as.wso2.org
      Info

      Each LB IP can have more than one hostname mappings. However, these mappings need to be defined separately in the /etc/hosts/ file.

  3. Optionally, add domain mapping if required.

    Expand
    titleClick here for instructions...

    Include Page
    Adding Domain Mappings
    Adding Domain Mappings

    For more information, see Working with Domain Mappings.

  4. Use the following URL format to access the WSO2 service (e.g., the ESB service):

    Localtabgroup
    Localtab
    activetrue
    titleEC2
    Panel
    Code Block
    http://<INSTANCE_HOSTNAME>:<LB_PROXY_PORT>/<CONTEXT_PATH>
    • <LOAD<INSTANCE_BALANCER_IP> - This will refer to the Load Balancer IP to which the cluster hostname was mapped to as explained in step 2HOSTNAME> The hostname of the cluster.
    • <LB_PROXY_PORT> - The LB proxy port to which the port was mapped to as explained in Prerequisites.


    Example:

    Code Block
     http://wso2as-521-application.mgt.as.wso2.org:80/index.php
    Localtab
    titleKubernetes
    Panel
    Code Block
    http://<LOAD<INSTANCE_BALANCER_IP>HOSTNAME>:<PROXY_SERVICE_PORT>/<CONTEXT_PATH>
    • <LOAD

      <INSTANCE_

      BALANCER_IP> - This will refer to the Load Balancer IP to which the cluster hostname was mapped to as explained in step 2

      HOSTNAME> - The hostname of the cluster.

    • <PROXY_SERVICE_PORT> - When using Kubernetes, you need to define the Kubernetes proxy service port range as 30000 - 32767 in the Kubernetes cluster definition, as there are different service port types with different port ranges in Kubernetes. Therefore, when using Kubernetes, the first proxy service that gets created will be assigned to port 30000, and the subsequent proxy services that get created will be assigned port values in order incrementally. Port ranges are not applicable when using PPaaS on Virtual Machines.

    Example:

    Code Block
    http://172.17.8.103wso2as-521-application.mgt.as.wso2.org:30000/index.php
    Info

    Currently, it is not possible to query auto generated Kubernetes proxy service ports via the Stratos API. However, they can be found on the PPaaS server log.