Hosts are the most basic unit of resource within Rancher and is represented as any Linux server, virtual or physical, with the following minimum requirements.
* Any modern Linux distribution that supports Docker 1.10.3+.
* Must be able to communicate with the Rancher server via http or https through the pre-configured port (Default is 8080).
* Must be routable to any other hosts belonging to the same environment to leverage Rancher’s cross-host networking for Docker containers.
Rancher also supports Docker Machine and allows you to add your host via any of its supported drivers.
| Field | Type | Create | Update | Default | Notes |
|---|---|---|---|---|---|
| description | string | Optional | Yes | - | |
| labels | map[string] | - | Yes | - | A map of key value pairs to be used as labels for the host |
| name | string | Optional | Yes | - |
| Field | Type | Notes |
|---|---|---|
| agentState | string | |
| computeTotal | int | |
| hostname | string | |
| id | int | The unique identifier for the host |
| info | json | |
| physicalHostId | physicalHost | |
| publicEndpoints | array[publicEndpoint] |
Please read more about the common resource fields. These fields are read only and applicable to almost every resource. We have segregated them from the list above.
DeleteDELETE: /v1/hosts/${ID}
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X DELETE \
'http://${RANCHER_URL}:8080/v1/hosts/${ID}'
UpdatePUT: /v1/hosts/${ID}
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X PUT \
-H 'Content-Type: application/json' \
-d '{
"description": "string",
"labels": {
"key": "value-pairs"
},
"name": "string"
}' 'http://${RANCHER_URL}:8080/v1/hosts/${ID}'
activate
POST: /v1/hosts/${ID}?action=activate
Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/hosts/${ID}?action=activate'
Output: An updated copy of the host resource
deactivate
POST: /v1/hosts/${ID}?action=deactivate
Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/hosts/${ID}?action=deactivate'
Output: An updated copy of the host resource
dockersocket
POST: /v1/hosts/${ID}?action=dockersocket
Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/hosts/${ID}?action=dockersocket'
Output: An updated copy of the hostAccess resource