This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Adding a Kubernetes-CoreOS Cluster - WSO2 Private PaaS 4.1.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

You can add a Kubernetes-CoreOS cluster using the CLI tool, REST API or the PPaaS Console as shown below:

 

Adding a Kubernetes-CoreOS cluster via the CLI

Overview
CLI command
add-kubernetes-cluster
DescriptionAdd a Kubernetes-CoreOS Cluster.
Command format
add-kubernetes-cluster -p <JSON_FILE_PATH>

The path to the JSON file that defines the Kubernetes-CoreOS Cluster needs to be defined as the <JSON_FILE_PATH> value.

Parameter definition
Short optionLong optionDescriptionRequiredExample value
-p
--resource-path Folder path where the JSON file that defines the Kubernetes-CoreOS Cluster is stored.Yes
                  <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/
kubernetes-clusters/kubernetes-cluster-ec2.json
Example

Define the Kubernetes-CoreOS Cluster information in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-cluster-ec2.json file. Thereafter, add the Kubernetes-CoreOS Cluster.

add-kubernetes-cluster -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-cluster-ec2.json
Sample output
Successfully added kubernetes cluster.

Adding a Kubernetes-CoreOS cluster via the REST API

Overview
DescriptionAdd a Kubernetes-CoreOS group.
Resource Path/kubernetesClusters
HTTP MethodPOST
Request/Response Formatapplication/json
Command format
curl -X POST -H "Content-Type: application/json" -d @'<JSON_PAYLOAD>' -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/kubernetesClusters
  • The path to the JSON file that defines the Kubernetes-CoreOS cluster needs to be defined as the <JSON_PAYLOAD> value.
  • By default, <USERNAME>:<PASSWORD> is admin:admin.
  • By default, <PRIVATE_PAAS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <PRIVATE_PAAS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
Example

Define the Kubernetes-CoreOS Cluster information in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-cluster-1.json file. Thereafter, add the Kubernetes-CoreOS Cluster.

cd <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/
curl -X POST -H "Content-Type: application/json" -d @'kubernetes-clusters/kubernetes-cluster-1.json' -k -v -u admin:admin https://localhost:9443/api/kubernetesClusters
Sample output
> POST /api/kubernetesClusters HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 1423
> Expect: 100-continue
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Mon, 28 Sep 2015 11:16:12 GMT
< Location: https://localhost:9443/api/kubernetesClusters/kubernetes-cluster-1
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
{"status":"success","message":"Kubernetes cluster added successfully: [kub-host-cluster] kubernetes-cluster-1"}

Following are the HTTP status codes you will come across while adding a Kubernetes-CoreOS cluster:

HTTP status code

201, 400, 409, 500

See the descriptions of the HTTP status codes here.

Location header URLhttps://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/kubernetesClusters/<KUBERNETES_GROUP_ID>

Adding a Kubernetes-CoreOS Cluster via the PPaaS Console

This following section explains how to add a new Kubernetes-CoreOS Cluster and its Slave/Master nodes through the PPaaS Console:

Adding Kubernetes Cluster via the UI editor

Follow the instructions below to add a Kubernetes-CoreOS Cluster:

  1. Click Configurations on the home page.
  2. Click Kubernetes Clusters. The Kubernetes Clusters page appears.
  3. Click ADD KUBERNETES CLUSTER. The form to add a new Kubernetes Cluster will appear in the UI editor.
  4. Enter the required details. For property definitions, see Kubernetes Cluster Resource Definition.
     
  5. Define the required properties.
    1. To define properties of the Kubernetes Master.
      1. Click Properties next to the caption Kubernetes Master.
      2. Select the properties that you wish to set at the Kubernetes master level.
      3. Optionally, if you wish to add a customized property at the Kubernetes-CoreOS master level, enter the property name and click +add to add it.
    2. To define properties of a Minion.
      1. Click Properties next to caption Minion.
      2. Select the properties that you wish to set at the Kubernetes-CoreOS Cluster level.
      3. Optionally, if you wish to add a customized property at the Kubernetes-CoreOS Cluster level, enter the property name and click +add to add it. 
    3. To define properties of items.
      1. Click Properties next to the respective Item you wish to define.
      2. Select the property fields that you wish to set at the property level.
      3. Optionally, if you wish to add a customized property at the property level, enter the property name and click +add to add it.
  6. Click SAVE KUBERNETES DEFINITION  to add the Kubernetes-CoreOS Cluster definition. 
     
Adding Kubernetes Cluster via the JSON editor

Follow the instructions below to add a Kubernetes-CoreOS Cluster:

  1. Click Configurations on the home page.
  2. Click Kubernetes Clusters. The Kubernetes Clusters page appears.
  3. Click ADD KUBERNETES CLUSTER. The form to add a new Kubernetes Cluster will appear in the UI editor.
  4. Click on the editor control to switch to the JSON editor. The JSON code format to add a Kubernetes Cluster will appear.
  5. Optionally, check the Auto correct with schema option to ensure that you do not accidentally delete any mandatory fields from the Kubernetes-CoreOS Cluster definition.
  6. Code the Kubernetes-CoreOS Cluster definition using JSON. For property definitions, see Kubernetes Cluster Resource Definition.
  7. Click SAVE KUBERNETES DEFINITION to add the Kubernetes-CoreOS Cluster definition.

 


Sample Kubernetes-CoreOS cluster JSON

{
  "clusterId": "kubernetes-cluster-1",
  "description": "Kubernetes Cluster 1",
  "kubernetesMaster": {
    "hostId": "master",
    "hostname": "master.dev.kubernetes.org",
    "privateIPAddress": "172.17.8.101",
    "publicIPAddress": "172.17.8.101",
    "property": [
      
    ]
  },
  "portRange": {
    "upper": "32767",
    "lower": "30000"
  },
  "kubernetesHosts": [
    {
      "hostId": "minion-1",
      "hostname": "minion-1.dev.kubernetes.org",
      "privateIPAddress": "172.17.8.102",
      "publicIPAddress": "172.17.8.102",
      "property": [
        
      ]
    }
  ],
  "property": [
    {
      "name": "payload_parameter.MB_IP",
      "value": "172.17.8.1"
    },
    {
      "name": "payload_parameter.MB_PORT",
      "value": "1883"
    },
    {
      "name": "payload_parameter.CEP_IP",
      "value": "172.17.8.1"
    },
    {
      "name": "payload_parameter.CEP_PORT",
      "value": "7711"
    },
    {
      "name": "payload_parameter.LOG_LEVEL",
      "value": "DEBUG"
    },
    {
      "name": "payload_parameter.METADATA_SERVICE_URL",
      "value": "https://172.17.8.1:9443"
    }
  ]
}
  • No labels