Skip to content

Latest commit

 

History

History
222 lines (179 loc) · 4.18 KB

client_curl_commands.md

File metadata and controls

222 lines (179 loc) · 4.18 KB

Client Curl Commands:


Get deployments

curl --request GET -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
https://localhost:8443/api/v1/namespaces/deployments

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

{
    "count": 20,
    "deployments": [
        {
            "name": "<name>",
            "namespace": "<namepsace>",
            "replicas": 1
        }...

Get deployments from a namespace

NAMESPACE=<namespace>

curl --request GET -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/api/v1/namespaces/${NAMESPACE}/deployments"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

{
    "count": 2,
    "deployments": [
        {
            "name": "deployment-1",
            "namespace": "<namespace>",
            "replicas": 1
        },
        {
            "name": "deployment-2",
            "namespace": "<namespace>",
            "replicas": 1
        }
    ]
}

Get deployment from namespace

NAMESPACE=<namespace>
NAME=<name>

curl --request GET -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/api/v1/namespaces/${NAMESPACE}/deployments/${NAME}"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

{
    "name": "<name>",
    "namespace": "<namespace>",
    "replicas": 1
}

Set replicas for a deployment

NAMESPACE=<namespace>
NAME=<name>
REPLICAS=<replicas>

curl --request PUT -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/api/v1/namespaces/${NAMESPACE}/deployments/${NAME}/replicas/${REPLICAS}"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

{
    "name": "<name>",
    "namespace": "<namespace>",
    "replicas": <replicas>,
    "Reconcile": false,
    "Time": "2022-08-30T00:33:36.280228-04:00"
}

Set replicas and reconcile for a deployment

NAMESPACE=<namespace>
NAME=<name>
REPLICAS=<replicas>

curl --request PUT -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/api/v1/namespaces/${NAMESPACE}/deployments/${NAME}/replicas/${REPLICAS}/reconcile"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

{
    "name": "<name>",
    "namespace": "<namespace>",
    "replicas": <replicas>,
    "Reconcile": true,
    "Time": "2022-08-30T00:37:52.477146-04:00"
}

Show replicas diff for a deployment

NAMESPACE=<namespace>
NAME=<name>

curl --request GET -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/api/v1/namespaces/${NAMESPACE}/deployments/${NAME}/diff"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT


{
    "name": "<name>",
    "namespace": "<namespace>",
    "diff": "replicas: 2 => 1"
}

Kubernetes API Health Check

curl --request GET -k \
--cert certs/client-1.crt \
--key certs/client-1.key \
--cacert certs/ca_cert.pem \
"https://localhost:8443/livez"

expected response

HTTP/2 200 
content-type: application/json
content-length: 1563
date: Tue, 30 Aug 2022 04:23:22 GMT

ok