doc-exports/docs/cce/api-ref/kubernetesapi.html
Dong, Qiu Jian e92285b9a2 CCE API update -20240815 version
Reviewed-by: Kovács, Zoltán <zkovacs@t-systems.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2024-09-17 14:12:43 +00:00

50 lines
5.8 KiB
HTML

<a name="kubernetesapi"></a><a name="kubernetesapi"></a>
<h1 class="topictitle1">Overview</h1>
<div id="body0000001355453942"><div class="section" id="kubernetesapi__section3701731155417"><h4 class="sectiontitle">Description</h4><p id="kubernetesapi__p8472102118288">Kubernetes APIs are resource-based (RESTful) programming interfaces provided through HTTP. It supports query, creation, update, and deletion of various cluster resources using standard HTTP request methods (POST, PUT, PATCH, DELETE, and GET).</p>
<p id="kubernetesapi__p8472521172810">CCE allows you to use native <a href="https://kubernetes.io/docs/reference/kubernetes-api/" target="_blank" rel="noopener noreferrer">Kubernetes APIs</a> in the following ways:</p>
<ul id="kubernetesapi__ul129695315280"><li id="kubernetesapi__li596915313282"><a href="#kubernetesapi__section41207155509">Calling Kubernetes APIs Through API Gateway</a></li><li id="kubernetesapi__li11831714192814"><a href="#kubernetesapi__section14674391312">Calling Kubernetes APIs Through the API Server</a></li></ul>
</div>
<div class="section" id="kubernetesapi__section41207155509"><a name="kubernetesapi__section41207155509"></a><a name="section41207155509"></a><h4 class="sectiontitle">Calling Kubernetes APIs Through API Gateway</h4><p id="kubernetesapi__p1777710173595">You can call Kubernetes native APIs through API Gateway using the URL in the format of <strong id="kubernetesapi__b178956281620">https://{<em id="kubernetesapi__i33322331464">clusterid</em>}.Endpoint/<em id="kubernetesapi__i694334415612">uri</em></strong>. In the URL, <em id="kubernetesapi__i111421351869">{clusterid}</em> indicates the cluster ID, and <em id="kubernetesapi__i121431235169">uri</em> indicates the resource path, that is, the path for API access.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="kubernetesapi__table7272144324912" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URL parameters</caption><thead align="left"><tr id="kubernetesapi__en-us_topic_0092901339_row12957510145518"><th align="left" class="cellrowborder" valign="top" width="24.529999999999998%" id="mcps1.3.2.3.2.3.1.1"><p id="kubernetesapi__en-us_topic_0092901339_p195751012559">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="75.47%" id="mcps1.3.2.3.2.3.1.2"><p id="kubernetesapi__en-us_topic_0092901339_p5957810135511">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="kubernetesapi__en-us_topic_0092901339_row12957210115515"><td class="cellrowborder" valign="top" width="24.529999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="kubernetesapi__en-us_topic_0092901339_p20957181010553">{clusterid}</p>
</td>
<td class="cellrowborder" valign="top" width="75.47%" headers="mcps1.3.2.3.2.3.1.2 "><p id="kubernetesapi__en-us_topic_0092901339_p19571410195516">Cluster ID. After a cluster is created, call the <a href="cce_02_0239.html">API for obtaining a cluster in a specified project</a> to obtain the cluster ID.</p>
</td>
</tr>
<tr id="kubernetesapi__en-us_topic_0092901339_row195716107550"><td class="cellrowborder" valign="top" width="24.529999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="kubernetesapi__en-us_topic_0092901339_p119571610115515">Endpoint</p>
</td>
<td class="cellrowborder" valign="top" width="75.47%" headers="mcps1.3.2.3.2.3.1.2 "><p id="kubernetesapi__en-us_topic_0092901339_p4957181017553">Web service entry URL. It can be obtained from <a href="https://docs.otc.t-systems.com/regions-and-endpoints/index.html" target="_blank" rel="noopener noreferrer">Regions and Endpoints</a>.</p>
</td>
</tr>
<tr id="kubernetesapi__en-us_topic_0092901339_row0957191065512"><td class="cellrowborder" valign="top" width="24.529999999999998%" headers="mcps1.3.2.3.2.3.1.1 "><p id="kubernetesapi__en-us_topic_0092901339_p179581410115511">uri</p>
</td>
<td class="cellrowborder" valign="top" width="75.47%" headers="mcps1.3.2.3.2.3.1.2 "><p id="kubernetesapi__en-us_topic_0092901339_p149587102555">Path in which the resource requested by the API is located. You can obtain the path from the URI of the API.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="kubernetesapi__section14674391312"><a name="kubernetesapi__section14674391312"></a><a name="section14674391312"></a><h4 class="sectiontitle">Calling Kubernetes APIs Through the API Server</h4><p id="kubernetesapi__p1248519452209">You can use the API server of a Kubernetes cluster to call Kubernetes native APIs.</p>
<ol id="kubernetesapi__ol1420332061712"><li id="kubernetesapi__li1013775412177"><span>Call the <a href="cce_02_0248.html">API for obtaining the cluster certificate</a> to obtain the cluster certificates.</span><p><p id="kubernetesapi__p10926184211419">There are three certificates:</p>
<ul id="kubernetesapi__ul934641310465"><li id="kubernetesapi__li834691314620">ca.crt</li><li id="kubernetesapi__li8347413184614">client.crt</li><li id="kubernetesapi__li1434717138467">client.key</li></ul>
</p></li><li id="kubernetesapi__li14730103613179"><span>Go to the cluster details page and obtain the API server address (private or public network address).</span><p><p id="kubernetesapi__p16832192924218">With the certificates and API server address, you can call Kubernetes native APIs.</p>
<p id="kubernetesapi__p12832182918428">For example, if you run the <strong id="kubernetesapi__b1746719199136">curl</strong> command to call the API to view the pod information, you only need to carry the certificate in the command as follows:</p>
<p id="kubernetesapi__p15832182914425"><strong id="kubernetesapi__b16832829154216">curl --cert ./client.crt --key ./client.key https://192.168.0.198:5443</strong><strong id="kubernetesapi__b68321029134215">/api/v1/namespaces/default/pods/</strong></p>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_02_0340.html">Kubernetes APIs</a></div>
</div>
</div>