<p>Is it possible in Kubernetes to create a pod template and reuse it later when specifying a pod within a deployment? For example:</p>

<p>Say I have pod template...</p>

<pre><code>apiVersion: v1
kind: PodTemplate
metadata:
  name: my-pod-template
template:
  metadata:
    labels:
      app: "my-app"
  spec:
    containers:
      - name: my-app
        image: jwaldrip/my-app:latest
</code></pre>

<p>Could I then use it in a deployment as so?</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-deployment
spec:
  template:
    metadata:
      name: my-pod-template
</code></pre>

<p>This would be super helpful when deploying something like Jobs, where I want to own the creation of a job with the given template.</p>

<p>There is not. </p>

<p>Specifically in the case of Pods, there are PodPresets:</p>

<p><a href="https://kubernetes.io/docs/tasks/inject-data-application/podpreset/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/inject-data-application/podpreset/</a></p>

<p>But those don't apply to other objects. </p>

<p>One way to enforce the shape or attributes of arbitrary objects is to establish tooling that correctly creates those objects, then create credentials for that tooling, and use RBAC to only allow those credentials to create those objects. </p>

<p><a href="https://kubernetes.io/docs/admin/authorization/rbac/" rel="nofollow noreferrer">https://kubernetes.io/docs/admin/authorization/rbac/</a></p>

<p>Another way would be to create an Admission Controller to watch the attempted creation of the desired objects, and verify/reject those that don't meet the criteria:</p>

<p><a href="https://kubernetes.io/docs/admin/admission-controllers/" rel="nofollow noreferrer">https://kubernetes.io/docs/admin/admission-controllers/</a></p>
