This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Page Comparison - Adding a Host to a Kubernetes-CoreOS Cluster (v.14 vs v.15) - WSO2 Private PaaS 4.1.0 - WSO2 Documentation

Versions Compared

Key

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

...

Localtab Group
Localtab
activetrue
titleCLI

Adding a host to a Kubernetes-CoreOS cluster via the CLI

Overview
CLI command

add-kubernetes-host

DescriptionAdd a host (slave) to an existing Kubernetes-CoreOS Cluster.
Command format
Code Block
add-kubernetes-host -p <JSON_FILE_PATH> -c <CLUSTER_ID>
Info

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

Parameter definition
Short optionLong optionDescriptionRequiredExample value
-p
--resource-pathFolder path where the JSON file that defines the Kubernetes-CoreOS host is stored.Yes
<PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/
kubernetes-clusters/kubernetes-host.json
-c--cluster-idID of the Kubernetes-CoreOS Cluster.Yeskubernetes-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.

Code Block
add-kubernetes-host -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/kubernetes-clusters/kubernetes-host.json -c kubernetes-cluster-ec2
Sample output
Code Block
You have successfully deployed host to Kubernetes cluster: kubernetes-cluster-ec2
Localtab
titleREST API

Adding a host to a Kubernetes-CoreOS cluster via the REST API

Overview
DescriptionAdd a host (slave) to an existing Kubernetes-CoreOS Cluster.
Resource Path/kubernetesClusters/{kubernetesClusterId}/minion
HTTP MethodPOST
Request/
Response Format
application/json
Command format
Code Block
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
Info
  • The path to the JSON file that defines the Kubernetes-CoreOS host 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 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.

Code Block
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
Code Block
> 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

https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/kubernetesClusters/<KUBERNETES_GROUP_ID>/minion/<MINION_ID>

 

 

...

Sample Kubernetes-CoreOS host JSON

Excerpt
Code Block
{
  "hostId": "minion-7",
  "hostname": "minion-7.dev.kubernetes.org",
  "privateIPAddress": "172.17.8.103",
  "publicIPAddress": "172.17.8.103",
  "property": [
     
  ]
}

 

...