forked from docs/doc-exports
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com> Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com> Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
146 lines
10 KiB
HTML
146 lines
10 KiB
HTML
<a name="cce_faq_00235"></a><a name="cce_faq_00235"></a>
|
|
|
|
<h1 class="topictitle1">How Can I Achieve Compatibility Between ExtendPathMode and Kubernetes client-go?</h1>
|
|
<div id="body8662426"><div class="section" id="cce_faq_00235__en-us_topic_0189140280_section1180212018441"><h4 class="sectiontitle">Application Scenarios</h4><p id="cce_faq_00235__en-us_topic_0189140280_p322814119441">The Kubernetes pod structure does not contain <strong id="cce_faq_00235__en-us_topic_0189140280_b889514562149">ExtendPathMode</strong>. Therefore, when a user calls the API for creating a pod or deployment by using client-go, the created pod does not contain <strong id="cce_faq_00235__en-us_topic_0189140280_b1690816195107">ExtendPathMode</strong>. CCE provides a solution to ensure compatibility with the Kubernetes client-go.</p>
|
|
</div>
|
|
<div class="section" id="cce_faq_00235__en-us_topic_0189140280_section17722153434512"><h4 class="sectiontitle">Solution</h4><div class="notice" id="cce_faq_00235__en-us_topic_0189140280_note10223132114613"><span class="noticetitle"><img src="public_sys-resources/notice_3.0-en-us.png"> </span><div class="noticebody"><ul id="cce_faq_00235__en-us_topic_0189140280_ul18967537124018"><li id="cce_faq_00235__en-us_topic_0189140280_li796863717406">When creating a pod, you need to add <strong id="cce_faq_00235__en-us_topic_0189140280_b109431634174010">kubernetes.io/extend-path-mode</strong> to <strong id="cce_faq_00235__en-us_topic_0189140280_b104837223516">annotation</strong> of the pod.</li><li id="cce_faq_00235__en-us_topic_0189140280_li14968193784014">When creating a Deployment, you need to add <strong id="cce_faq_00235__en-us_topic_0189140280_b6698155213402">kubernetes.io/extend-path-mode</strong> to <strong id="cce_faq_00235__en-us_topic_0189140280_b15665104415352">kubernetes.io/extend-path-mode</strong> in the template.</li></ul>
|
|
</div></div>
|
|
<p id="cce_faq_00235__en-us_topic_0189140280_p1560134814713">The following is an example YAML of creating a pod. After the <strong id="cce_faq_00235__en-us_topic_0189140280_b588865503620">kubernetes.io/extend-path-mode</strong> keyword is added to <strong id="cce_faq_00235__en-us_topic_0189140280_b1896210716375">annotation</strong>, the <strong id="cce_faq_00235__en-us_topic_0189140280_b1331840201119">containername</strong>, <strong id="cce_faq_00235__en-us_topic_0189140280_b9182194315117">name</strong>, and <strong id="cce_faq_00235__en-us_topic_0189140280_b1682183715578">mountpath</strong> fields are matched, and the corresponding <strong id="cce_faq_00235__en-us_topic_0189140280_b10702164745720">extendpathmode</strong> is added to <strong id="cce_faq_00235__en-us_topic_0189140280_b546015910588">volumeMount</strong>.</p>
|
|
<pre class="screen" id="cce_faq_00235__en-us_topic_0189140280_screen1941194119508">apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: test-8b59d5884-96vdz
|
|
generateName: test-8b59d5884-
|
|
namespace: default
|
|
selfLink: /api/v1/namespaces/default/pods/test-8b59d5884-96vdz
|
|
labels:
|
|
app: test
|
|
pod-template-hash: 8b59d5884
|
|
annotations:
|
|
<strong id="cce_faq_00235__en-us_topic_0189140280_b15866173433">kubernetes.io/extend-path-mode: '[{"containername":"container-0","name":"vol-156738843032165499","mountpath":"/tmp","extendpathmode":"PodUID"}]'</strong>
|
|
metrics.alpha.kubernetes.io/custom-endpoints: '[{"api":"","path":"","port":"","names":""}]'
|
|
ownerReferences:
|
|
- apiVersion: apps/v1
|
|
kind: ReplicaSet
|
|
name: test-8b59d5884
|
|
uid: 2633020b-cd23-11e9-8f83-fa163e592534
|
|
controller: true
|
|
blockOwnerDeletion: true
|
|
spec:
|
|
volumes:
|
|
- name: vol-156738843032165499
|
|
hostPath:
|
|
path: /tmp
|
|
type: ''
|
|
- name: default-token-4s959
|
|
secret:
|
|
secretName: default-token-4s959
|
|
defaultMode: 420
|
|
containers:
|
|
- name: container-0
|
|
image: 'nginx:latest'
|
|
env:
|
|
- name: PAAS_APP_NAME
|
|
value: test
|
|
- name: PAAS_NAMESPACE
|
|
value: default
|
|
- name: PAAS_PROJECT_ID
|
|
value: b6315dd3d0ff4be5b31a963256794989
|
|
resources:
|
|
limits:
|
|
cpu: 250m
|
|
memory: 512Mi
|
|
requests:
|
|
cpu: 250m
|
|
memory: 512Mi
|
|
volumeMounts:
|
|
- name: vol-156738843032165499
|
|
mountPath: /tmp
|
|
<strong id="cce_faq_00235__en-us_topic_0189140280_b198431230144310">extendPathMode: PodUID</strong>
|
|
- name: default-token-4s959
|
|
readOnly: true
|
|
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
|
terminationMessagePath: /dev/termination-log
|
|
terminationMessagePolicy: File
|
|
imagePullPolicy: Always
|
|
restartPolicy: Always
|
|
terminationGracePeriodSeconds: 30
|
|
dnsPolicy: ClusterFirst
|
|
serviceAccountName: default
|
|
serviceAccount: default
|
|
nodeName: 192.168.0.24
|
|
securityContext: {}
|
|
imagePullSecrets:
|
|
- name: default-secret
|
|
- name: default-secret
|
|
affinity: {}
|
|
schedulerName: default-scheduler
|
|
tolerations:
|
|
- key: node.kubernetes.io/not-ready
|
|
operator: Exists
|
|
effect: NoExecute
|
|
tolerationSeconds: 300
|
|
- key: node.kubernetes.io/unreachable
|
|
operator: Exists
|
|
effect: NoExecute
|
|
tolerationSeconds: 300
|
|
priority: 0
|
|
dnsConfig:
|
|
options:
|
|
- name: timeout
|
|
value: ''
|
|
- name: ndots
|
|
value: '5'
|
|
- name: single-request-reopen
|
|
enableServiceLinks: true</pre>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="cce_faq_00235__en-us_topic_0189140280_table3607132591112" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Descriptions of key parameters</caption><thead align="left"><tr id="cce_faq_00235__en-us_topic_0189140280_row860817252116"><th align="left" class="cellrowborder" valign="top" width="22.022202220222024%" id="mcps1.3.2.5.2.4.1.1"><p id="cce_faq_00235__en-us_topic_0189140280_p3608625111118"><strong id="cce_faq_00235__en-us_topic_0189140280_b19381121103811">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="20.89208920892089%" id="mcps1.3.2.5.2.4.1.2"><p id="cce_faq_00235__en-us_topic_0189140280_p15608202519119"><strong id="cce_faq_00235__en-us_topic_0189140280_b3848233383">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="57.085708570857086%" id="mcps1.3.2.5.2.4.1.3"><p id="cce_faq_00235__en-us_topic_0189140280_p1608182513118"><strong id="cce_faq_00235__en-us_topic_0189140280_b1230132483817">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="cce_faq_00235__en-us_topic_0189140280_row66084257112"><td class="cellrowborder" valign="top" width="22.022202220222024%" headers="mcps1.3.2.5.2.4.1.1 "><p id="cce_faq_00235__en-us_topic_0189140280_p5504204415718">containername</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.89208920892089%" headers="mcps1.3.2.5.2.4.1.2 "><p id="cce_faq_00235__en-us_topic_0189140280_a7ad0d857ec4a4a41b591ac17dff62b87">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.085708570857086%" headers="mcps1.3.2.5.2.4.1.3 "><p id="cce_faq_00235__en-us_topic_0189140280_p1160892511112">Name of a container.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="cce_faq_00235__en-us_topic_0189140280_row156081625131111"><td class="cellrowborder" valign="top" width="22.022202220222024%" headers="mcps1.3.2.5.2.4.1.1 "><p id="cce_faq_00235__en-us_topic_0189140280_p660852519112">name</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.89208920892089%" headers="mcps1.3.2.5.2.4.1.2 "><p id="cce_faq_00235__en-us_topic_0189140280_p1926194016179">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.085708570857086%" headers="mcps1.3.2.5.2.4.1.3 "><p id="cce_faq_00235__en-us_topic_0189140280_p13293213282">Name of a volume.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="cce_faq_00235__en-us_topic_0189140280_row9608172516116"><td class="cellrowborder" valign="top" width="22.022202220222024%" headers="mcps1.3.2.5.2.4.1.1 "><p id="cce_faq_00235__en-us_topic_0189140280_p123041028081">mountpath</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.89208920892089%" headers="mcps1.3.2.5.2.4.1.2 "><p id="cce_faq_00235__en-us_topic_0189140280_p13571143201719">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.085708570857086%" headers="mcps1.3.2.5.2.4.1.3 "><p id="cce_faq_00235__en-us_topic_0189140280_p1284112371813">Mount path.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="cce_faq_00235__en-us_topic_0189140280_row14530431585"><td class="cellrowborder" valign="top" width="22.022202220222024%" headers="mcps1.3.2.5.2.4.1.1 "><p id="cce_faq_00235__en-us_topic_0189140280_p15454443389">extendpathmode</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="20.89208920892089%" headers="mcps1.3.2.5.2.4.1.2 "><p id="cce_faq_00235__en-us_topic_0189140280_p14454114320810">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="57.085708570857086%" headers="mcps1.3.2.5.2.4.1.3 "><p id="cce_faq_00235__en-us_topic_0189140280_p9731758194313">A third-level directory is added to the created volume directory/subdirectory to facilitate the obtaining of a single pod output file.</p>
|
|
<p id="cce_faq_00235__en-us_topic_0189140280_p14542433812">The following types are supported. </p>
|
|
<ul id="cce_faq_00235__en-us_topic_0189140280_ul1219917563122"><li id="cce_faq_00235__en-us_topic_0189140280_li1719925661213"><strong id="cce_faq_00235__en-us_topic_0189140280_b152575164214">None</strong>: The extended path is not configured.</li><li id="cce_faq_00235__en-us_topic_0189140280_li1199456161215"><strong id="cce_faq_00235__en-us_topic_0189140280_b89592023134316">PodUID</strong>: ID of a pod.</li><li id="cce_faq_00235__en-us_topic_0189140280_li320013561128"><strong id="cce_faq_00235__en-us_topic_0189140280_b164731114316">PodName</strong>: Name of a pod.</li><li id="cce_faq_00235__en-us_topic_0189140280_li2020085615124"><strong id="cce_faq_00235__en-us_topic_0189140280_b2030983604316">PodUID/ContainerName</strong>: ID of a pod or name of a container.</li><li id="cce_faq_00235__en-us_topic_0189140280_li62005561128"><strong id="cce_faq_00235__en-us_topic_0189140280_b19710194104410">PodName/ContainerName</strong>: Name of a pod or container.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="cce_faq_00037.html">Storage</a></div>
|
|
</div>
|
|
</div>
|
|
|