How can I define the pod's name of replicas using deployment?

2/17/2021

I am doing a deployment with kubernetes using the following template:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ter-deployment
  labels:
    app: ter
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ter
  template:
    metadata:
      labels:
        app: ter
    spec:
      containers:
      - name: ter
        image: ter:0.0.1
        ports:
        - containerPort: 4000
        env:
        - name: MONGO_URI
          valueFrom:
            secretKeyRef:
              name: mongo-uri
              key: mongo-uri
        - name: NODE_ENV
          value: prod
        - name: LOGS_PATH
          value: logs

The problem with this is that when I apply this, kubernetes creates one pod with the following name:

ter-xxxxxx

How can I set that xxxx?

Thanks

-- Tlaloc-ES
kubernetes

0 Answers