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 |
Description | Add 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 |
Parameter definition
Short option | Long option | Description | Required | Example 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/ |
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
Description | Add a Kubernetes-CoreOS group. |
Resource Path | /kubernetesClusters |
HTTP Method | POST |
Request/Response Format | application/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
|
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 URL | https://<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:
- Click Configurations on the home page.
- Click Kubernetes Clusters. The Kubernetes Clusters page appears.
- Click ADD KUBERNETES CLUSTER. The form to add a new Kubernetes Cluster will appear in the UI editor.
- Enter the required details. For property definitions, see Kubernetes Cluster Resource Definition.
- Define the required properties.
- To define properties of the Kubernetes Master.
- Click Properties next to the caption Kubernetes Master.
- Select the properties that you wish to set at the Kubernetes master level.
- 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.
- To define properties of a Minion.
- Click Properties next to caption Minion.
- Select the properties that you wish to set at the Kubernetes-CoreOS Cluster level.
- 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.
- To define properties of items.
- Click Properties next to the respective Item you wish to define.
- Select the property fields that you wish to set at the property level.
- Optionally, if you wish to add a customized property at the property level, enter the property name and click +add to add it.
- To define properties of the Kubernetes Master.
- 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:
- Click Configurations on the home page.
- Click Kubernetes Clusters. The Kubernetes Clusters page appears.
- Click ADD KUBERNETES CLUSTER. The form to add a new Kubernetes Cluster will appear in the UI editor.
- Click on the editor control to switch to the JSON editor. The JSON code format to add a Kubernetes Cluster will appear.
- 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.
- Code the Kubernetes-CoreOS Cluster definition using JSON. For property definitions, see Kubernetes Cluster Resource Definition.
- 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" } ] }