Files
docs/doc/source/usertasks/kubernetes/using-an-image-from-the-local-docker-registry-in-a-container-spec.rst
Keane Lim 21b11b47d6 OpenStack VNF Integration User Tasks
Completed review comments
Minor abbreviation fix
Moved topics into its own VNF Integration section
Fixed abbreviations
Re-organized Kubernetes topics

Change-Id: I8940d3572b789990d3b5f2d201f8ec8a46ce2943
Signed-off-by: Keane Lim <keane.lim@windriver.com>
2021-03-23 11:10:42 -04:00

2.1 KiB

Use an Image from the Local Docker Registry in a Container Spec

When creating a pod spec or a deployment spec that uses an image from the local docker registry, you must use the full image name, including the registry, and specify an imagePullSecret with your keystone credentials.

This example procedure assumes that testuser/busybox:latest container image has been pushed to the local docker registry.

  1. Create a secret with credentials for the local docker registry.

    % kubectl create secret docker-registry testuser-registry-secret --docker-server=registry.local:9001 --docker-username=testuser --docker-password=<testuserPassword> --docker-email=noreply@windriver.com
  2. Create a configuration for the busybox container.

    % cat <<EOF > busybox.yaml
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: busybox
      namespace: default
    spec:
      progressDeadlineSeconds: 600
      replicas: 1
      selector:
        matchLabels:
          run: busybox
      template:
        metadata:
          labels:
            run: busybox
        spec:
          containers:
          - args:
            - sh
            image: registry.local:9001/testuser/busybox:latest
            imagePullPolicy: Always
            name: busybox
            stdin: true
            tty: true
          restartPolicy: Always
          imagePullSecrets:
          - name: testuser-registry-secret
    EOF
  3. Apply the configuration created in the busybox.yaml file.

    % kubectl apply -f busybox.yaml

    This will launch the busybox deployment using the image in the local docker registry and specifying the testuser-registry-secret for authentication and authorization with the registry.