2021-07-11 08:42:56 -05:00
---
id: kubernetes
title: "Kubernetes"
---
You can find instructions to deploy Verdaccio on a Kubernetes cluster on the
[verdaccio/docker-example ](https://github.com/verdaccio/verdaccio/tree/5.x/docker-examples/kubernetes-example )
repository. However, the recommended method to install Verdaccio on a Kubernetes
cluster is to use [Helm ](https://helm.sh ). Helm is a
[Kubernetes ](https://kubernetes.io ) package manager which bring multiple
advantages.
2021-07-27 14:52:49 -05:00
## Helm {#helm}
2021-07-11 08:42:56 -05:00
2021-07-27 14:52:49 -05:00
### Setup Helm {#setup-helm}
2021-07-11 08:42:56 -05:00
If you haven't used Helm before, you need to setup the Helm controller called
Tiller:
```bash
helm init
```
2021-07-27 14:52:49 -05:00
### Install {#install}
2021-07-11 08:42:56 -05:00
> ⚠️ If you are using this helm chart, please [be aware of the migration of the repository](https://github.com/verdaccio/verdaccio/issues/1767).
Deploy the Helm [verdaccio/verdaccio ](https://github.com/verdaccio/charts )
chart.
2021-07-27 14:52:49 -05:00
### Add repository {#add-repository}
2021-07-11 08:42:56 -05:00
```
helm repo add verdaccio https://charts.verdaccio.org
```
In this example we use `npm` as release name:
```bash
helm install npm verdaccio/verdaccio
```
2021-07-27 14:52:49 -05:00
### Deploy a specific version {#deploy-a-specific-version}
2021-07-11 08:42:56 -05:00
```bash
helm install npm --set image.tag=3.13.1 verdaccio/verdaccio
```
2021-07-27 14:52:49 -05:00
### Upgrading Verdaccio {#upgrading-verdaccio}
2021-07-11 08:42:56 -05:00
```bash
helm upgrade npm verdaccio/verdaccio
```
2021-07-27 14:52:49 -05:00
### Uninstalling {#uninstalling}
2021-07-11 08:42:56 -05:00
```bash
helm uninstall npm
```
**Note:** this command delete all the resources, including packages that you may
have previously published to the registry.
2021-07-27 14:52:49 -05:00
### Custom Verdaccio configuration {#custom-verdaccio-configuration}
2021-07-11 08:42:56 -05:00
You can customize the Verdaccio configuration using a Kubernetes *configMap* .
2021-07-27 14:52:49 -05:00
#### Prepare {#prepare}
2021-07-11 08:42:56 -05:00
Copy the [existing configuration ](https://github.com/verdaccio/verdaccio/blob/master/conf/docker.yaml )
and adapt it for your use case:
```bash
2021-07-13 13:06:21 -05:00
wget https://raw.githubusercontent.com/verdaccio/verdaccio/master/packages/config/src/conf/docker.yaml -O config.yaml
2021-07-11 08:42:56 -05:00
```
**Note:** Make sure you are using the right path for the storage that is used for
persistency:
```yaml
storage: /verdaccio/storage/data
auth:
htpasswd:
file: /verdaccio/storage/htpasswd
```
2021-07-27 14:52:49 -05:00
#### Deploy the configMap {#deploy-the-configmap}
2021-07-11 08:42:56 -05:00
Deploy the `configMap` to the cluster
```bash
kubectl create configmap verdaccio-config --from-file ./config.yaml
```
2021-07-27 14:52:49 -05:00
#### Deploy Verdaccio {#deploy-verdaccio}
2021-07-11 08:42:56 -05:00
Now you can deploy the Verdaccio Helm chart and specify which configuration to
use:
```bash
2021-09-14 13:38:50 -05:00
helm install npm --set existingConfigMap=verdaccio-config verdaccio/verdaccio
2021-07-11 08:42:56 -05:00
```
2022-04-25 13:51:50 -05:00
### 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 ](https://kubernetes.io/docs/concepts/configuration/secret/ ).
1. Update your Verdaccio config according to the [Uplinks ](./uplinks.md#auth-property ) documentation
2. Pass the secret environment variable to your values file or via `--set secretEnvVars.FOO_TOKEN=superSecretBarToken`
```yaml
# values.yaml
secretEnvVars:
FOO_TOKEN: superSecretBarToken
```
2021-07-27 14:52:49 -05:00
#### NGINX proxy body-size limit {#nginx-proxy-body-size-limit}
2021-07-11 08:42:56 -05:00
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 ](https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#custom-max-body-size ):
```yaml
...
annotations:
...
kubernetes.io/proxy-body-size: 20m
....
...
```
2021-07-27 14:52:49 -05:00
## Rancher Support {#rancher-support}
2021-07-11 08:42:56 -05:00
[Rancher ](http://rancher.com/ ) is a complete container management platform that makes managing and using containers in production really easy.
* [verdaccio-rancher ](https://github.com/lgaticaq/verdaccio-rancher )