<p>I am new to kubernetes. Is there anyway we can fix the name of pod ?   If we are creating only one replica, then I want to be generated with same name all time. It's generating different name all time. If I want to see the logs of a container, each time I need to change the command with the newly generated pod name.</p>

<p>Following is sample of YAML file.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: nagendra-app-deploy1
spec:
  replicas: 1
  template:
    metadata:
      name: nagendra-app-deploy1
      labels:
        app: nagendra-app-deploy1
    spec:
      containers:
      - name: nagendra-spring-app1
        image: springbootapp:v1
        ports:
        - containerPort: 8080
      - name: nagendra-myImage
        image: myImage:v2
</code></pre>

nagendra547
<p>There is no way to generate the same name for a deployment produced pod. as far as the command is concerned, you can use <code>kubectl get po -l app=nagendra-app-deploy1 -o jsonpath={.items[0].metadata.name}</code> to get the pod's name.</p>
