Setup Skaffold with a private registry

Jake Peterson
1 min readJul 19, 2022

In your cluster create the required kubernetes secrets from the docker config file

Get the docker config json from ~/.docker/config.json

Create the following generic secrets in your cluster

docker-cfg as a generic secret with key of config.json

kaniko-secret as a generic secret with key of kaniko-secret

Add the docker config json to both secrets

In the skaffold yaml add

cluster:
pullSecretName: kaniko-secret
dockerConfig:
secretName: docker-cfg
namespace: default

You should know be able to authenticate with the private registry

Reference: https://skaffold.dev/docs/pipeline-stages/builders/docker/

Note: Set the NPM_TOKEN environmental variable if needing to authenticate with a private npm registry as well. For gitlab this was set to my personal access token. Make sure that the private npm registry is setup in the .npmrc file with the proper address to the private npm registry. This will look something like below for gitlab

@jpetersondev:registry = "<registry domain>/api/v4/projects/3/packages/npm/"//<registry domain>/api/v4/projects/3/packages/npm/:_authToken=${NPM_TOKEN}

--

--