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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Current »

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

add-kubernetes-host

DescriptionAdd 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 <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.

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
DescriptionAdd a host (slave) to an existing Kubernetes-CoreOS Cluster.
Resource Path/kubernetesClusters/{kubernetesClusterId}/minion
HTTP MethodPOST
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
  • 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.

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

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

 


 

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": [
     
  ]
}

 

 

  • No labels