Reading a Service
Function
This API is used to query the details about a specified service.
URI
GET /api/v1/namespaces/{namespace}/services/{name}
| Parameter | Description |
|---|---|
| namespace | Object name and auth scope, such as for teams and projects. |
| name | Name of the Service. |
| Parameter | Mandatory | Description |
|---|---|---|
| pretty | No | If 'true', then the output is pretty printed. |
| exact | No | Should the export be exact. Exact export maintains cluster-specific fields like 'Namespace'. |
| export | No | Should this value be exported. Export strips fields that a user cannot specify. |
Request
N/A
Response
Response parameters
For the description about response parameters, see Table 101.
Example response
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"namespace": "namespace-test",
"selfLink": "/api/v1/namespaces/namespace-test/services/redis",
"uid": "d6a1ce79-afdb-11e8-b6ef-f898ef6c78b4",
"resourceVersion": "5146412",
"creationTimestamp": "2018-09-04T00:45:36Z",
"labels": {
"app": "redis"
},
"enable": true
},
"spec": {
"ports": [
{
"name": "service0",
"protocol": "TCP",
"port": 8080,
"targetPort": 80
}
],
"selector": {
"app": "redis"
},
"clusterIP": "10.247.212.210",
"type": "ClusterIP",
"sessionAffinity": "None"
},
"status": {
"loadBalancer": {}
}
} Status Code
Table 3 describes the status code of this API.
| Status Code | Description |
|---|---|
| 200 | This operation succeeds, and a Service resource object is returned. |
For more status codes, see Status Codes.
Last Article: Creating a Service
Next Article: Listing Services
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.