Documentation

esc
    Container Registry / CI and Kubernetes

    Registry tokens, CI and Kubernetes

    Give CI a push token and your clusters a pull token, each limited to the repositories they need, with examples for GitHub Actions, GitLab and Kubernetes.

    An API key can log in to the registry, but it can also change everything else in your organization. For CI and clusters, make a registry token instead: it works only for the registry, for the repositories you choose.

    Registry tokens

    A registry token has:

    • A permission: pull, or push (which can pull too).
    • The repositories it may use. Leave it empty for every repository in the namespace.
    • An optional expiry, at most 10 years away.

    In the console, open Container registry, then Registry tokens, and press New token. Or:

    Terminal
    $ pantech registry tokens create --name github-actions --permission push \    --repo api/server --expires 2027-11-10 > token.txt

    The CLI prints the secret alone on standard output, so you can send it straight to a file or your CI's secret store.

    The token is shown once, like prt_06gk3x9tq7m2v8r4y1c5d0zp8w_…. Copy it into your CI's secret store straight away. Pantech keeps only a hash of it and cannot show it again. If you lose it, revoke it and make another.

    Owners and admins are emailed when a token is created (registry.token.created), as a security notice.

    A token cannot call the Pantech API. Use it as the password, with the user name pantech:

    Terminal
    $ echo "$PANTECH_REGISTRY_TOKEN" | docker login registry.pantechdynamics.com -u pantech --password-stdin

    The token list shows each one's id, permission, repositories, expiry and when it was last used. Revoke a token you no longer need, by its id:

    Terminal
    $ pantech registry tokens list$ pantech registry tokens revoke prt_06gk3x9tq7m2v8r4y1c5d0zp8w

    New logins with it are refused at once. A client that already logged in can keep using it for up to 5 minutes.

    Only owners and admins can create and revoke tokens (or a member an access policy allows registry:ManageTokens). A token never gives more than its creator has: making a push token needs registry:Push on every repository it lists, and it stops working if its creator leaves the organization. An organization can have 50 (REGISTRY_TOKEN_LIMIT_REACHED).

    GitHub Actions

    Make a push token for the repository the workflow builds, and save it as the repository secret PANTECH_REGISTRY_TOKEN.

    YAML
    name: image
    on:
      push:
        tags: ["v*"]
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - uses: docker/login-action@v3
            with:
              registry: registry.pantechdynamics.com
              username: pantech
              password: ${{ secrets.PANTECH_REGISTRY_TOKEN }}
          - uses: docker/build-push-action@v6
            with:
              push: true
              tags: registry.pantechdynamics.com/acme/api/server:${{ github.ref_name }}

    GitLab CI

    Save a push token as the masked CI/CD variable PANTECH_REGISTRY_TOKEN.

    YAML
    build:
      image: docker:27
      services: ["docker:27-dind"]
      variables:
        IMAGE: registry.pantechdynamics.com/acme/api/server:$CI_COMMIT_TAG
      script:
        - echo "$PANTECH_REGISTRY_TOKEN" | docker login registry.pantechdynamics.com -u pantech --password-stdin
        - docker build -t "$IMAGE" .
        - docker push "$IMAGE"
      rules:
        - if: $CI_COMMIT_TAG

    Kubernetes

    A cluster pulls private images with an image pull secret. Give it a pull token, limited to the repositories it runs.

    Make a pull token, then store it in the cluster as an image pull secret, in the namespace your workloads run in. The console's Registry tokens page shows the same commands under Pull from Kubernetes.

    Terminal
    $ kubectl create secret docker-registry pantech-registry \    --docker-server=registry.pantechdynamics.com \    --docker-username=pantech \    --docker-password="$PANTECH_REGISTRY_TOKEN" \    --namespace default

    Refer to it from your pods:

    YAML
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: api
    spec:
      replicas: 2
      selector:
        matchLabels: { app: api }
      template:
        metadata:
          labels: { app: api }
        spec:
          imagePullSecrets:
            - name: pantech-registry
          containers:
            - name: api
              image: registry.pantechdynamics.com/acme/api/server:v1.4.2

    Pantech managed Kubernetes

    A Pantech cluster uses a pull secret made this way, like any other cluster: Pantech does not add one for you. Pulls from Pantech clusters stay inside Pantech.

    Every pod in a namespace

    To use it for every pod in a namespace without editing each one, attach it to the namespace's default service account:

    Terminal
    $ kubectl patch serviceaccount default -n default \    -p '{"imagePullSecrets": [{"name": "pantech-registry"}]}'

    When the token expires or is revoked, pods that need to pull again fail with ImagePullBackOff. Make a new token and update the secret.

    From code

    Go
    tok, err := c.Registry.CreateToken(ctx, pantech.CreateRegistryTokenRequest{
    	Name:         "prod-cluster",
    	Permission:   "pull",
    	Repositories: []string{"api/server"},
    })
    if err != nil {
    	return err
    }
    fmt.Println(tok.Secret) // shown once: store it now

    See registry tokens in the API reference.

    Was this page helpful?

    Updated