<p>Below is my kubernetes deployment file -</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: boxfusenew
  labels:
    app: boxfusenew
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: boxfusenew
    spec:
      containers:
      - image: sk1997/boxfuse:latest
        name: boxfusenew
        ports:
        - containerPort: 8080
</code></pre>

<p>In this deployment file under container tag <strong>boxfusenew</strong> pod name is specified. So I want the pod generated by deployment file should have the <strong>boxfusenew</strong> name but the deployment is attaching some random value to it as- <strong>boxfusenew-5f6f67fc5-kmb7z</strong>.</p>

<p>Is it possible to ignore random values in pod name through deployment file??</p>

<p>Not really, unless you create the Pod itself and not a deployment.</p>
<p>According to Kubernetes <a href="https://kubernetes.io/docs/concepts/overview/working-with-objects/names/" rel="nofollow noreferrer">documentation</a>:</p>
<blockquote>
<p>Each object in your cluster has a Name that is unique for that type of resource. Every Kubernetes object also has a UID that is unique across your whole cluster.</p>
<p>For example, you can only have one Pod named myapp-1234 within the same namespace, but you can have one Pod and one Deployment that are each named myapp-1234.</p>
<p>For non-unique user-provided attributes, Kubernetes provides labels and annotations.</p>
</blockquote>
<p>If you create a Pod with a specific unique label, you can use this label to query the Pod, so no need of having the exact name.</p>
<p>You can use a jsonpath to query the values that you want from your Pod under that specific deployment. I've created an example that may give you an idea:</p>
<p><code>kubectl get pods -o=jsonpath='{.items[?(@.metadata.labels.app==&quot;boxfusenew&quot;)].metadata.name}'</code></p>
<p>This would return the name of the Pod which contains the label <code>app=boxfusenew</code>. You can take a look into some other examples of jsonpath <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#viewing-finding-resources" rel="nofollow noreferrer">here</a> and <a href="https://kubernetes.io/docs/reference/kubectl/jsonpath/" rel="nofollow noreferrer">here</a>.</p>
