Welcome to the Linux Foundation Forum!

Section 7 page 7

ehj52n
ehj52n Posts: 12
edited November 2023 in LFS258 Class Forum

template:spec:containers.0.name is not the leading stub of the pod name as outlined in the name element on page 7 in section 7:

The leading stub of the Pod names. A unique string will be appended.

See my example below:

$ cat pod-name.yaml \
    && kubectl create -f pod-name.yaml \
    && sleep 30 \
    && kubectl get deployments.apps \
    && kubectl get pods 
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: app-label
  name: deployment-name
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: app-label
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: app-label
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: container-name
        ports:
        - containerPort: 80
          protocol: TCP
        resources: {}
      restartPolicy: Always
deployment.apps/deployment-name created
NAME              READY   UP-TO-DATE   AVAILABLE   AGE
deployment-name   1/1     1            1           30s
NAME                               READY   STATUS    RESTARTS   AGE
deployment-name-7fd486f7c5-dv9g4   1/1     Running   0          30s

The container name must be used for certain sub commands as parameter value for --container, e.g. kubectl logs or kubectl exec, if you have more than one container in your deployments containers element.

Please update or clarify the name element on page 7 in section 7.

Categories

Upcoming Training