how can I use curl to test kubernetes API on ICp how can I use curl to test kubernetes API on ICp kubernetes kubernetes

how can I use curl to test kubernetes API on ICp


The answer is yes. But first you may need to pay attention to the default port for --insecure-port and --secure-port. By default, if you didn't change it in config.yaml file, ICp use below ports to accept REST requests:

--insecure-port=8888

--secure-port=8001

netstat -anp|grep 8888

or

netstat -anp|grep 8001

Or you can

ps -ef|grep apiserver

result something like:

root      5462  5442  9 Jan29 ?        22:48:09 /hyperkube apiserver--secure-port=8001 --bind-address=0.0.0.0 --advertise-address=10.0.14.94 --insecure-port=8888 --insecure-bind-address=127.0.0.1 ......

Once you find the port, on master node, you can issue the curl quickly, first try via a insecure port:

curl http://localhost:8888/api

result something like:

{  "kind": "APIVersions",  "versions": [    "v1"  ],  "serverAddressByClientCIDRs": [    {      "clientCIDR": "0.0.0.0/0",      "serverAddress": "10.0.14.94:8001"    }  ]}

further call to /api/v1 and /api/v1/pods, /api/v1/services are as you like.

But you cannot do the same on other node. On other node, you may have to use secure port, but with a -k parameter to ignore the certificate:

on client or other node:

curl -k https://10.0.14.94:8001/api

result should be the same unless you specify the ca certificate.