Kubernetes
Les instructions pour développer Verdaccio sur un cluster Kubernetes sont disponibles dans l’archive verdaccio/docker-example. Cependant, la méthode recommandée pour installer Verdaccio sur un cluster Kubernetes consiste à utiliser Helm. Helm est un Kubernetes gestionnaire de paquets, qui présente de nombreux avantages.
Helm
Configurer Helm
Si vous n'avez jamais utilisé Helm, vous devez configurer le contrôleur Helm dit Tiller:
helm init
Installer
⚠️ If you are using this helm chart, please be aware of the migration of the repository.
Développez la charte de Helm stable/verdaccio.
Déployer une version spécifique
helm install --name npm stable/verdaccio
Remarque: cette commande supprime toutes les ressources, y compris les packages que vous avez peut-être déjà publiés dans le registre.
helm install --name npm --set image.tag=2.6.5 stable/verdaccio
Deploy a specific version
helm upgrade npm stable/verdaccio
Développer Verdaccio
helm del --purge npm
Désinstallation
wget https://raw.githubusercontent.com/verdaccio/verdaccio/master/conf/docker.yaml -O config.yaml
Vous pouvez personnaliser la configuration de Verdaccio en utilisant un Kubernetes configMap.
Configuration personnalisée de Verdaccio
Copy the existing configuration and adapt it for your use case:
Préparer
Remarque: assurez-vous que vous utilisez le chemin correct d'archivage utilisé pour la persistance:
torage: /verdaccio/storage/data
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
Développer le configMap
dans le cluster
storage: /verdaccio/storage/data
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
Développer le configMap
Maintenant, vous pouvez développer le tableau Verdaccio Helm et spécifier la configuration à utiliser:
kubectl create configmap verdaccio-config --from-file ./config.yaml
Deploy Verdaccio
Rancher est une plate-forme complète de gestion de conteneurs facilitant la gestion et l'utilisation des conteneurs en production.
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.
- Update your Verdaccio config according to the Uplinks documentation
- 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
....
...
Support Rancher
Rancher is a complete container management platform that makes managing and using containers in production really easy.