You can add a host to a Kubernetes-CoreOS cluster using the CLI tool or REST API, as shown below:
Adding a host to a Kubernetes-CoreOS cluster via the CLI
Overview
CLI command |
|
Description | Add a host (slave) to an existing Kubernetes-CoreOS Cluster. |
Command format | add-kubernetes-host -p <JSON_FILE_PATH> -c <CLUSTER_ID> The path to the JSON file that defines the Kubernetes-CoreOS host 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 host is stored. | Yes | <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/ |
-c | --cluster-id | ID of the Kubernetes-CoreOS Cluster. | Yes | kubernetes-cluster-ec2 |
Example
Define the Kubernetes-CoreOS host information in a JSON file, which is stored in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-host.json
directory. Thereafter, add the host to the Kubernetes-CoreOS Cluster.
add-kubernetes-host -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-host.json -c kubernetes-cluster-ec2
Sample output
You have successfully deployed host to Kubernetes cluster: kubernetes-cluster-ec2
Adding a host to a Kubernetes-CoreOS cluster via the REST API
Overview
Description | Add a host (slave) to an existing Kubernetes-CoreOS Cluster. |
Resource Path | /kubernetesClusters/{kubernetesClusterId}/minion |
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/{kubernetesClusterId}/minion
|
Example
Define the Kubernetes-CoreOS host information in a JSON file, which is stored in the
<PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples
/kubernetes-clusters/kubernetes-host.json
directory. Thereafter, add the host to 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-host.json' -k -v -u admin:admin https://localhost:9443/api/kubernetesClusters/kubernetes-cluster-1/minion
Sample output
> POST /api/kubernetesClusters/kubernetes-cluster-1/minion HTTP/1.1 > Host: localhost:9443 > Authorization: Basic YWRtaW46YWRtaW4= > User-Agent: curl/7.43.0 > Accept: */* > Content-Type: application/json > Content-Length: 166 > < HTTP/1.1 201 Created < Date: Fri, 02 Oct 2015 08:14:15 GMT < Location: https://localhost:9443/api/kubernetesClusters/kubernetes-cluster-1/minion/minion-7 < Content-Type: application/json < Transfer-Encoding: chunked < Server: WSO2 Carbon Server < {"status":"success","message":"Kubernetes host added successfully: [kub-host] minion-7"}
Following are the HTTP status codes you will come across while adding a Kubernetes-CoreOS host:
HTTP status code | 201, 400, 409, 500 See the descriptions of the HTTP status codes here. |
Location header URL |
|
Sample Kubernetes-CoreOS host JSON
{ "hostId": "minion-7", "hostname": "minion-7.dev.kubernetes.org", "privateIPAddress": "172.17.8.103", "publicIPAddress": "172.17.8.103", "property": [ ] }