Skip to main content
Version: 6.x

Kubernetes

Você pode encontrar instruções para implantar o Verdaccio em um cluster do Kubernetes no repositório verdaccio/docker-example. No entanto, o método recomendado para instalar o Verdaccio em um cluster de Kubernetes é usando Helm. Helm é um gerenciador de pacotes do Kubernetes que traz múltiplas vantagens.

Helm

Configurando o Helm

Se você nunca usou Helm antes, você precisará configurar o controlador do Helm chamado Tiller:

helm init

Instalação

⚠️ If you are using this helm chart, please be aware of the migration of the repository.

Implemente o gráfico Helm stable/verdaccio.

Implemente uma versão específica

helm install --name npm stable/verdaccio

Nota: este comando apaga todos os recursos, incluindo pacotes que você pode ter publicado anteriormente no registro.

helm install --name npm --set image.tag=2.6.5 stable/verdaccio

Deploy a specific version

helm upgrade npm stable/verdaccio

Atualizando o Verdaccio

helm del --purge npm

Desinstalando

wget https://raw.githubusercontent.com/verdaccio/verdaccio/master/conf/docker.yaml -O config.yaml

Você pode personalizar a configuração do Verdaccio usando um Kubernetes configMap.

Configuração personalizada do Verdaccio

You can customize the Verdaccio configuration using a Kubernetes configMap.

Preparo

Nota: Verifique se você está usando o caminho certo para o armazenamento usado pela persistência:

wget https://raw.githubusercontent.com/verdaccio/verdaccio/master/packages/config/src/conf/docker.yaml -O config.yaml

Implemente o configMap no cluster

storage: /verdaccio/storage/data
auth:
htpasswd:
file: /verdaccio/storage/htpasswd

Implementando o configMap

Agora você pode lançar a tabela Verdaccio Helm e especificar qual configuração usar:

kubectl create configmap verdaccio-config --from-file ./config.yaml

Lançando Verdaccio

Rancher é uma plataforma completa de gerenciamento de contêineres que facilita o gerenciamento e o uso de contêineres na produção.

helm install npm --set existingConfigMap=verdaccio-config verdaccio/verdaccio

Authenticate with private upstreams using Helm

As of version 4.8.0 of the helm chart, a new secretEnvVars field has been added.
This allows you to inject sensitive values to the container via a Kubernetes Secret.

  1. Update your Verdaccio config according to the Uplinks documentation
  2. Pass the secret environment variable to your values file or via --set secretEnvVars.FOO_TOKEN=superSecretBarToken
# values.yaml
secretEnvVars:
FOO_TOKEN: superSecretBarToken

NGINX proxy body-size limit

The standard k8s NGINX ingress proxy allows for 1MB for body-size which can be increased by modifying the default deployment options according to the documentation:

...

annotations:
...

kubernetes.io/proxy-body-size: 20m
....
...

Suporte Rancher

Rancher is a complete container management platform that makes managing and using containers in production really easy.