From ef1bd347ff0f00f8ee673df1f526fb9b34afb03f Mon Sep 17 00:00:00 2001 From: Etienne Tremel Date: Tue, 5 Dec 2017 21:03:07 +0100 Subject: [PATCH] Add Kubernetes instructions --- wiki/README.md | 5 +-- wiki/kubernetes.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 wiki/kubernetes.md diff --git a/wiki/README.md b/wiki/README.md index e88e99ba1..4713a5be5 100644 --- a/wiki/README.md +++ b/wiki/README.md @@ -48,7 +48,7 @@ from a fresh look at the code and the outstanding issues. So here we are 🎉 ### UI Customization -* [Configure the Web](web.md) +* [Configure the Web](web.md) ## Server Configurations @@ -69,6 +69,7 @@ from a fresh look at the code and the outstanding issues. So here we are 🎉 * [Configure with Ansible](ansible.md) * [Using Docker Image](docker.md) +* [Using Kubernetes](kubernetes.md) ## Verdaccio Recipes @@ -80,4 +81,4 @@ from a fresh look at the code and the outstanding issues. So here we are 🎉 * [Build verdaccio](dev/build.md) * [Create plugins](dev/plugins.md) * [Repositories](dev/repositories.md) -* [Unit Testing](dev/test.md) +* [Unit Testing](dev/test.md) diff --git a/wiki/kubernetes.md b/wiki/kubernetes.md new file mode 100644 index 000000000..aa09fc564 --- /dev/null +++ b/wiki/kubernetes.md @@ -0,0 +1,90 @@ +# Kubernetes + + You can find instructions to deploy Verdaccio on a Kubernetes cluster on the +[verdaccio/docker-example](https://github.com/verdaccio/docker-examples/tree/master/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. + +## Helm + +### Setup Helm + +If you haven't used Helm before, you need to setup the Helm controller called +Tiller: + +```bash +helm init +``` + +### Install + +Deploy the Helm [stable/verdaccio](https://github.com/kubernetes/charts/tree/master/stable/verdaccio) +chart. In this example we use `npm` as release name: + +```bash +helm install --name npm stable/verdaccio +``` + +### Deploy a specific version + +```bash +helm install --name npm --set image.tag=2.6.5 stable/verdaccio +``` + +### Upgrading Verdaccio + +```bash +helm upgrade npm stable/verdaccio +``` + +### Uninstalling + +```bash +helm del --purge npm +``` + +**Note:** this command delete all the resources, including packages that you may +have previously published to the registry. + + +### Custom Verdaccio configuration + +You can customize the Verdaccio configuration using a Kubernetes *configMap*. + +#### Prepare + +Copy the [existing configuration](https://github.com/verdaccio/verdaccio/blob/master/conf/full.yaml) +and adapt it for your use case: + +```bash +wget https://github.com/verdaccio/verdaccio/blob/master/conf/full.yaml -O config.yaml +``` + +**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 +``` + +#### Deploy the configMap + +Deploy the `configMap` to the cluster + +```bash +kubectl create configmap verdaccio-config --from-file ./config.yaml +``` + +#### Deploy Verdaccio + +Now you can deploy the Verdaccio Helm chart and specify which configuration to +use: + +```bash +helm install --name npm --set customConfigMap=verdaccio-config stable/verdaccio +```