tillrohrmann commented on a change in pull request #14629:
URL: https://github.com/apache/flink/pull/14629#discussion_r581924392



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -100,6 +104,17 @@ protected void initializeInternal() throws Exception {
         kubeClientOpt =
                 Optional.of(kubeClientFactory.fromConfiguration(flinkConfig, 
getIoExecutor()));
         podsWatchOpt = watchTaskManagerPods();
+        taskManagerPodTemplate =
+                flinkConfig
+                        
.getOptional(KubernetesConfigOptions.TASK_MANAGER_POD_TEMPLATE)
+                        .map(
+                                ignore ->
+                                        
KubernetesUtils.loadPodFromTemplateFile(
+                                                kubeClientOpt.get(),
+                                                
KubernetesUtils.getTaskManagerPodTemplateFileInPod(
+                                                        flinkConfig),
+                                                Constants.MAIN_CONTAINER_NAME))
+                        .orElse(new FlinkPod.Builder().build());

Review comment:
       Just a thought. Couldn't we check here whether 
`Constants.TASK_MANAGER_POD_TEMPLATE_FILE_NAME` exists? If it exists, then we 
load it and if not then we use `FlinkPod.Builder().build()`. 
   
   Then we would not have to check a configuration option which is not used 
afterwards. I think at the moment the contract is if 
`TASK_MANAGER_POD_TEMPLATE` is set, then we will create a 
`Constants.TASK_MANAGER_POD_TEMPLATE_FILE_NAME` file. That's why we can check 
`KubernetesConfigOptions.TASK_MANAGER_POD_TEMPLATE` here in order to tell 
whether there is a `Constants.TASK_MANAGER_POD_TEMPLATE_FILE_NAME` or not. This 
might be easier if we directly check for 
`Constants.TASK_MANAGER_POD_TEMPLATE_FILE_NAME`.

##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClient.java
##########
@@ -339,6 +342,16 @@ public void close() {
         this.internalClient.close();
     }
 
+    @Override
+    public KubernetesPod loadPodFromTemplateFile(File file) {
+        if (!file.exists()) {
+            throw new FlinkRuntimeException(
+                    String.format("Pod template file %s does not exist.", 
file),
+                    new FileNotFoundException());

Review comment:
       I think we don't need to instantiate a `FileNotFoundException` here.

##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecorator.java
##########
@@ -98,7 +103,7 @@ private Container decorateMainContainer(Container container) 
{
                 
.withImagePullPolicy(kubernetesJobManagerParameters.getImagePullPolicy().name())
                 .withResources(requirements)
                 .withPorts(getContainerPorts())

Review comment:
       Also here are a couple of options which might be configured via the pod 
template and later overwritten by the default value of a Flink configuration 
option. I think this goes in the same direction as what Xintong mentioned 
before. Understanding which parts can be freely configured via the pod template 
and which parts are read from `flink-conf.yaml` might be confusing to the user. 
Not sure whether this is feasible or not but maybe we could log whenever we 
overwrite a pod template configuration with an explicitly configured value from 
`flink-conf.yaml`. Also it might help to log the resulting pod template which 
is used for creating the pod.

##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecorator.java
##########
@@ -98,7 +103,7 @@ private Container decorateMainContainer(Container container) 
{
                 
.withImagePullPolicy(kubernetesJobManagerParameters.getImagePullPolicy().name())
                 .withResources(requirements)
                 .withPorts(getContainerPorts())

Review comment:
       Here for example, the user might wanna configure some extra ports for 
queryable state or so.

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.

Review comment:
       Does this mean that if the config option is not specified, then we will 
take the default value of the `ConfigOption`?

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the

Review comment:
       "It will be used ~~, instead of an empty pod,~~ to initialize the"

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.
+* **Overwritten by Flink.** Definitions in the template will take effect, with 
additional contents from Flink.
+
+Refer to the following tables for the full list of pod fields that will be 
overwritten.
+All the fields defined in the pod template that are not listed in the tables 
will be unaffected.
+
+<span class="label label-info">Note</span> Flink may overwrite more fields 
from pod templates in future releases.
+While it is undetermined which fields might be overwritten in the future, 
Flink provides the following list of fields that are planned to be long-term 
supported: `annotations`, `labels`, `imagePullSecrets`, `nodeSelector`, 
`tolerations`, `env`, `init container`, `sidecar container`, `volumes`.
+
+**Pod Metadata**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The JobManager pod name will be overwritten with the 
deployment which is defined by <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-cluster-id">kubernetes.cluster-id</a>.
+                The TaskManager pod names will be overwritten with the pattern 
<code>&lt;clusterID&gt;-&lt;attempt&gt;-&lt;index&gt;</code> which is generated 
by Flink ResourceManager.</td>
+        </tr>
+        <tr>
+            <td>namespace</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-namespace">kubernetes.namespace</a></td>
+            <td>Both the JobManager deployment and TaskManager pods will be 
created in the specified namespace.</td>
+        </tr>
+        <tr>
+            <td>ownerReferences</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-owner-reference">kubernetes.jobmanager.owner.reference</a></td>
+            <td>The owner reference of JobManager deployment could be set by 
configuration option.
+                And the owner reference of every TaskManager pod will be set 
to JobManager deployment.</td>
+        </tr>
+        <tr>
+            <td>annotations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-annotations">kubernetes.jobmanager.annotations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-annotations">kubernetes.taskmanager.annotations</a></td>
+            <td>Flink will add additional annotations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>labels</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-labels">kubernetes.jobmanager.labels</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-labels">kubernetes.taskmanager.labels</a></td>
+            <td>Flink will add additional labels specified by the Flink 
configuration options.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Pod Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>imagePullSecrets</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-secrets">kubernetes.container.image.pull-secrets</a></td>
+            <td>Flink will add additional pull secrets specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>nodeSelector</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-node-selector">kubernetes.jobmanager.node-selector</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-node-selector">kubernetes.taskmanager.node-selector</a></td>
+            <td>Flink will add additional node selectors specified by the 
Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>tolerations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-tolerations">kubernetes.jobmanager.tolerations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-tolerations">kubernetes.taskmanager.tolerations</a></td>
+            <td>Flink will add additional tolerations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>restartPolicy</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>"always" for JobManager pod and "never" for TaskManager pod.
+                <br>
+                The JobManager pod will always be restarted by deployment. And 
the TaskManager pod should not be restarted.</td>
+        </tr>
+        <tr>
+            <td>serviceAccount</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-service-account">kubernetes.service-account</a></td>
+            <td>The JobManager deployment and TaskManager pods will be created 
with the specified service account.</td>
+        </tr>
+        <tr>
+            <td>volumes</td>
+            <td>Overwritten by Flink</td>
+            <td></td>
+            <td>Flink will add some additional internal ConfigMap volumes(e.g. 
flink-config-volume, hadoop-config-volume) which is necessary for shipping the 
Flink configuration and hadoop configuration.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Main Container Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>env</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.master.env.{ENV_NAME}</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.taskmanager.env.{ENV_NAME}</a></td>
+            <td>Flink will add additional environment variables specified by 
the Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>image</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image">kubernetes.container.image</a></td>
+            <td>The container image will be overwritten by flink configuration 
option.</td>

Review comment:
       "by Flink"

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)

Review comment:
       Flink allows users to define the JobManager and TaskManager pods via 
template files. This allows to support advanced features

##########
File path: 
flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/resources/FlinkPodTest.java
##########
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.kubeclient.resources;
+
+import org.apache.flink.kubernetes.KubernetesPodTemplateTestUtils;
+import org.apache.flink.kubernetes.KubernetesTestBase;
+import org.apache.flink.kubernetes.kubeclient.FlinkPod;
+import org.apache.flink.kubernetes.utils.KubernetesUtils;
+
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.equalTo;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+/** Tests for {@link FlinkPod}. */
+public class FlinkPodTest extends KubernetesTestBase {
+
+    @Test
+    public void testCopyFlinkPod() {
+        final FlinkPod flinkPod =
+                KubernetesUtils.loadPodFromTemplateFile(
+                        flinkKubeClient,
+                        KubernetesPodTemplateTestUtils.getPodTemplateFile(),
+                        
KubernetesPodTemplateTestUtils.TESTING_MAIN_CONTAINER_NAME);
+        final FlinkPod clonedFlinkPod = flinkPod.copy();

Review comment:
       nit: `copiedFlinkPod`

##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/decorators/InitJobManagerDecorator.java
##########
@@ -60,14 +60,14 @@ public FlinkPod decorateFlinkPod(FlinkPod flinkPod) {
                 new PodBuilder(flinkPod.getPod())
                         .withApiVersion(API_VERSION)
                         .editOrNewMetadata()
-                        .withLabels(kubernetesJobManagerParameters.getLabels())
-                        
.withAnnotations(kubernetesJobManagerParameters.getAnnotations())
+                        
.addToLabels(kubernetesJobManagerParameters.getLabels())
+                        
.addToAnnotations(kubernetesJobManagerParameters.getAnnotations())
                         .endMetadata()
                         .editOrNewSpec()
                         
.withServiceAccountName(kubernetesJobManagerParameters.getServiceAccount())

Review comment:
       Does it make sense to only override the service account name if an 
explicit service account name has been configured?
   
   Maybe the following precedence could work:
   
   1. Service account specified via in flink-conf.yaml
   2. Service account specified in pod template
   3. Default value of `KUBERNETES_SERVICE_ACCOUNT`

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the

Review comment:
       "contains the pod definition" or "contains the pod template".

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.

Review comment:
       The mechanism for resolving effective field values can be categorized as 
follows:

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.
+* **Overwritten by Flink.** Definitions in the template will take effect, with 
additional contents from Flink.

Review comment:
       Overwritten by Flink sounds as if we are replacing the template fields 
with something. Maybe "Merged with Config Option" describes it a bit better.

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.
+* **Overwritten by Flink.** Definitions in the template will take effect, with 
additional contents from Flink.
+
+Refer to the following tables for the full list of pod fields that will be 
overwritten.
+All the fields defined in the pod template that are not listed in the tables 
will be unaffected.
+
+<span class="label label-info">Note</span> Flink may overwrite more fields 
from pod templates in future releases.
+While it is undetermined which fields might be overwritten in the future, 
Flink provides the following list of fields that are planned to be long-term 
supported: `annotations`, `labels`, `imagePullSecrets`, `nodeSelector`, 
`tolerations`, `env`, `init container`, `sidecar container`, `volumes`.
+
+**Pod Metadata**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The JobManager pod name will be overwritten with the 
deployment which is defined by <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-cluster-id">kubernetes.cluster-id</a>.
+                The TaskManager pod names will be overwritten with the pattern 
<code>&lt;clusterID&gt;-&lt;attempt&gt;-&lt;index&gt;</code> which is generated 
by Flink ResourceManager.</td>
+        </tr>
+        <tr>
+            <td>namespace</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-namespace">kubernetes.namespace</a></td>
+            <td>Both the JobManager deployment and TaskManager pods will be 
created in the specified namespace.</td>
+        </tr>
+        <tr>
+            <td>ownerReferences</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-owner-reference">kubernetes.jobmanager.owner.reference</a></td>
+            <td>The owner reference of JobManager deployment could be set by 
configuration option.
+                And the owner reference of every TaskManager pod will be set 
to JobManager deployment.</td>
+        </tr>
+        <tr>
+            <td>annotations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-annotations">kubernetes.jobmanager.annotations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-annotations">kubernetes.taskmanager.annotations</a></td>
+            <td>Flink will add additional annotations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>labels</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-labels">kubernetes.jobmanager.labels</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-labels">kubernetes.taskmanager.labels</a></td>
+            <td>Flink will add additional labels specified by the Flink 
configuration options.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Pod Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>imagePullSecrets</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-secrets">kubernetes.container.image.pull-secrets</a></td>
+            <td>Flink will add additional pull secrets specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>nodeSelector</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-node-selector">kubernetes.jobmanager.node-selector</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-node-selector">kubernetes.taskmanager.node-selector</a></td>
+            <td>Flink will add additional node selectors specified by the 
Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>tolerations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-tolerations">kubernetes.jobmanager.tolerations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-tolerations">kubernetes.taskmanager.tolerations</a></td>
+            <td>Flink will add additional tolerations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>restartPolicy</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>"always" for JobManager pod and "never" for TaskManager pod.
+                <br>
+                The JobManager pod will always be restarted by deployment. And 
the TaskManager pod should not be restarted.</td>
+        </tr>
+        <tr>
+            <td>serviceAccount</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-service-account">kubernetes.service-account</a></td>
+            <td>The JobManager deployment and TaskManager pods will be created 
with the specified service account.</td>
+        </tr>
+        <tr>
+            <td>volumes</td>
+            <td>Overwritten by Flink</td>
+            <td></td>
+            <td>Flink will add some additional internal ConfigMap volumes(e.g. 
flink-config-volume, hadoop-config-volume) which is necessary for shipping the 
Flink configuration and hadoop configuration.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Main Container Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>env</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.master.env.{ENV_NAME}</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.taskmanager.env.{ENV_NAME}</a></td>
+            <td>Flink will add additional environment variables specified by 
the Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>image</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image">kubernetes.container.image</a></td>
+            <td>The container image will be overwritten by flink configuration 
option.</td>
+        </tr>
+        <tr>
+            <td>imagePullPolicy</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-policy">kubernetes.container.image.pull-policy</a></td>
+            <td>The container image pull policy will be overwritten by flink 
configuration option.</td>
+        </tr>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The container name will be overwritten by flink with 
"flink-main-container".</td>

Review comment:
       "by Flink"

##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/FlinkPod.java
##########
@@ -48,6 +48,12 @@ public Container getMainContainer() {
         return mainContainer;
     }
 
+    public FlinkPod clone() {
+        return new FlinkPod(
+                new PodBuilder(this.getPod()).build(),
+                new ContainerBuilder(this.getMainContainer()).build());

Review comment:
       Maybe we could also rename `getPod()` into `getPodWithoutMainContainer()`

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.
+* **Overwritten by Flink.** Definitions in the template will take effect, with 
additional contents from Flink.
+
+Refer to the following tables for the full list of pod fields that will be 
overwritten.
+All the fields defined in the pod template that are not listed in the tables 
will be unaffected.
+
+<span class="label label-info">Note</span> Flink may overwrite more fields 
from pod templates in future releases.
+While it is undetermined which fields might be overwritten in the future, 
Flink provides the following list of fields that are planned to be long-term 
supported: `annotations`, `labels`, `imagePullSecrets`, `nodeSelector`, 
`tolerations`, `env`, `init container`, `sidecar container`, `volumes`.
+
+**Pod Metadata**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The JobManager pod name will be overwritten with the 
deployment which is defined by <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-cluster-id">kubernetes.cluster-id</a>.
+                The TaskManager pod names will be overwritten with the pattern 
<code>&lt;clusterID&gt;-&lt;attempt&gt;-&lt;index&gt;</code> which is generated 
by Flink ResourceManager.</td>
+        </tr>
+        <tr>
+            <td>namespace</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-namespace">kubernetes.namespace</a></td>
+            <td>Both the JobManager deployment and TaskManager pods will be 
created in the specified namespace.</td>
+        </tr>
+        <tr>
+            <td>ownerReferences</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-owner-reference">kubernetes.jobmanager.owner.reference</a></td>
+            <td>The owner reference of JobManager deployment could be set by 
configuration option.
+                And the owner reference of every TaskManager pod will be set 
to JobManager deployment.</td>
+        </tr>
+        <tr>
+            <td>annotations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-annotations">kubernetes.jobmanager.annotations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-annotations">kubernetes.taskmanager.annotations</a></td>
+            <td>Flink will add additional annotations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>labels</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-labels">kubernetes.jobmanager.labels</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-labels">kubernetes.taskmanager.labels</a></td>
+            <td>Flink will add additional labels specified by the Flink 
configuration options.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Pod Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>imagePullSecrets</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-secrets">kubernetes.container.image.pull-secrets</a></td>
+            <td>Flink will add additional pull secrets specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>nodeSelector</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-node-selector">kubernetes.jobmanager.node-selector</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-node-selector">kubernetes.taskmanager.node-selector</a></td>
+            <td>Flink will add additional node selectors specified by the 
Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>tolerations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-tolerations">kubernetes.jobmanager.tolerations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-tolerations">kubernetes.taskmanager.tolerations</a></td>
+            <td>Flink will add additional tolerations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>restartPolicy</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>"always" for JobManager pod and "never" for TaskManager pod.
+                <br>
+                The JobManager pod will always be restarted by deployment. And 
the TaskManager pod should not be restarted.</td>
+        </tr>
+        <tr>
+            <td>serviceAccount</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-service-account">kubernetes.service-account</a></td>
+            <td>The JobManager deployment and TaskManager pods will be created 
with the specified service account.</td>
+        </tr>
+        <tr>
+            <td>volumes</td>
+            <td>Overwritten by Flink</td>
+            <td></td>
+            <td>Flink will add some additional internal ConfigMap volumes(e.g. 
flink-config-volume, hadoop-config-volume) which is necessary for shipping the 
Flink configuration and hadoop configuration.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Main Container Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>env</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.master.env.{ENV_NAME}</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.taskmanager.env.{ENV_NAME}</a></td>
+            <td>Flink will add additional environment variables specified by 
the Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>image</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image">kubernetes.container.image</a></td>
+            <td>The container image will be overwritten by flink configuration 
option.</td>
+        </tr>
+        <tr>
+            <td>imagePullPolicy</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-policy">kubernetes.container.image.pull-policy</a></td>
+            <td>The container image pull policy will be overwritten by flink 
configuration option.</td>

Review comment:
       "by Flink"

##########
File path: 
docs/content.zh/docs/deployment/resource-providers/native_kubernetes.md
##########
@@ -324,4 +324,235 @@ $ kubectl create clusterrolebinding 
flink-role-binding-flink --clusterrole=edit
 
 Please refer to the official Kubernetes documentation on [RBAC 
Authorization](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) 
for more information.
 
+### Pod Template
+
+Flink allows users to define the JobManager and TaskManager pods via template 
files, with the advanced features (e.g. volumes, init containers, sidecar 
containers, etc.)
+that are not supported by Flink [Kubernetes config options]({{< ref 
"docs/deployment/config" >}}#kubernetes) directly.
+Use [`kubernetes.pod-template-file`]({{< ref "docs/deployment/config" 
>}}#kubernetes-pod-template-file)
+to specify a local file that contains pod definition. It will be used, instead 
of an empty pod, to initialize the
+JobManager and TaskManager. The main container should be defined with name 
`flink-main-container`.
+Please refer to the [pod template example](#example-of-pod-template) for more 
information.
+
+#### Fields Overwritten by Flink
+
+Some fields of the pod template can be overwritten by Flink.
+The overwritten mechanism can be categorized as follows.
+* **Defined by Flink.** Definitions in the template won't take effect. User 
cannot control the fields.
+* **Defined by Config Option.** Definitions in the template won't take effect. 
User can control the fields via config options.
+* **Overwritten by Flink.** Definitions in the template will take effect, with 
additional contents from Flink.
+
+Refer to the following tables for the full list of pod fields that will be 
overwritten.
+All the fields defined in the pod template that are not listed in the tables 
will be unaffected.
+
+<span class="label label-info">Note</span> Flink may overwrite more fields 
from pod templates in future releases.
+While it is undetermined which fields might be overwritten in the future, 
Flink provides the following list of fields that are planned to be long-term 
supported: `annotations`, `labels`, `imagePullSecrets`, `nodeSelector`, 
`tolerations`, `env`, `init container`, `sidecar container`, `volumes`.
+
+**Pod Metadata**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The JobManager pod name will be overwritten with the 
deployment which is defined by <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-cluster-id">kubernetes.cluster-id</a>.
+                The TaskManager pod names will be overwritten with the pattern 
<code>&lt;clusterID&gt;-&lt;attempt&gt;-&lt;index&gt;</code> which is generated 
by Flink ResourceManager.</td>
+        </tr>
+        <tr>
+            <td>namespace</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-namespace">kubernetes.namespace</a></td>
+            <td>Both the JobManager deployment and TaskManager pods will be 
created in the specified namespace.</td>
+        </tr>
+        <tr>
+            <td>ownerReferences</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-owner-reference">kubernetes.jobmanager.owner.reference</a></td>
+            <td>The owner reference of JobManager deployment could be set by 
configuration option.
+                And the owner reference of every TaskManager pod will be set 
to JobManager deployment.</td>
+        </tr>
+        <tr>
+            <td>annotations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-annotations">kubernetes.jobmanager.annotations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-annotations">kubernetes.taskmanager.annotations</a></td>
+            <td>Flink will add additional annotations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>labels</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-labels">kubernetes.jobmanager.labels</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-labels">kubernetes.taskmanager.labels</a></td>
+            <td>Flink will add additional labels specified by the Flink 
configuration options.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Pod Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>imagePullSecrets</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-secrets">kubernetes.container.image.pull-secrets</a></td>
+            <td>Flink will add additional pull secrets specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>nodeSelector</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-node-selector">kubernetes.jobmanager.node-selector</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-node-selector">kubernetes.taskmanager.node-selector</a></td>
+            <td>Flink will add additional node selectors specified by the 
Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>tolerations</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-tolerations">kubernetes.jobmanager.tolerations</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-tolerations">kubernetes.taskmanager.tolerations</a></td>
+            <td>Flink will add additional tolerations specified by the Flink 
configuration options.</td>
+        </tr>
+        <tr>
+            <td>restartPolicy</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>"always" for JobManager pod and "never" for TaskManager pod.
+                <br>
+                The JobManager pod will always be restarted by deployment. And 
the TaskManager pod should not be restarted.</td>
+        </tr>
+        <tr>
+            <td>serviceAccount</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-service-account">kubernetes.service-account</a></td>
+            <td>The JobManager deployment and TaskManager pods will be created 
with the specified service account.</td>
+        </tr>
+        <tr>
+            <td>volumes</td>
+            <td>Overwritten by Flink</td>
+            <td></td>
+            <td>Flink will add some additional internal ConfigMap volumes(e.g. 
flink-config-volume, hadoop-config-volume) which is necessary for shipping the 
Flink configuration and hadoop configuration.</td>
+        </tr>
+    </tbody>
+</table>
+
+**Main Container Spec**
+<table class="table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 10%">Key</th>
+            <th class="text-left" style="width: 20%">Category</th>
+            <th class="text-left" style="width: 30%">Related Config 
Options</th>
+            <th class="text-left" style="width: 40%">Description</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>env</td>
+            <td>Overwritten by Flink</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.master.env.{ENV_NAME}</a>
+                <a href="{{< ref "docs/deployment/config" 
>}}#forwarding-environment-variables">containerized.taskmanager.env.{ENV_NAME}</a></td>
+            <td>Flink will add additional environment variables specified by 
the Flink configuration options.</td>
+        </tr>
+        <tr>
+            <td>image</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image">kubernetes.container.image</a></td>
+            <td>The container image will be overwritten by flink configuration 
option.</td>
+        </tr>
+        <tr>
+            <td>imagePullPolicy</td>
+            <td>Defined by Config Option</td>
+            <td><a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-container-image-pull-policy">kubernetes.container.image.pull-policy</a></td>
+            <td>The container image pull policy will be overwritten by flink 
configuration option.</td>
+        </tr>
+        <tr>
+            <td>name</td>
+            <td>Defined by Flink</td>
+            <td></td>
+            <td>The container name will be overwritten by flink with 
"flink-main-container".</td>
+        </tr>
+        <tr>
+            <td>resources</td>
+            <td>Defined by Config Option</td>
+            <td>Memory: <br>
+                    <a href="{{< ref "docs/deployment/config" 
>}}#jobmanager-memory-process-size">jobmanager.memory.process.size</a>
+                    <a href="{{< ref "docs/deployment/config" 
>}}#taskmanager-memory-process-size">taskmanager.memory.process.size</a>
+                <br>
+                CPU: <br>
+                    <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-jobmanager-cpu">kubernetes.jobmanager.cpu</a>
+                    <a href="{{< ref "docs/deployment/config" 
>}}#kubernetes-taskmanager-cpu">kubernetes.taskmanager.cpu</a></td>
+            <td>The memory and cpu resources(including requests and limits) 
will be overwritten by flink. All other resources(e.g. ephemeral-storage) will 
be retained.</td>

Review comment:
       "by Flink"




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to