One place for hosting & domains

      Clusters

      How To Install Software on Kubernetes Clusters with the Helm 3 Package Manager


      Introduction

      Helm is a package manager for Kubernetes that allows developers and operators to more easily configure and deploy applications on Kubernetes clusters.

      In this tutorial, you will set up Helm 3 and use it to install, reconfigure, rollback, and delete an instance of the Kubernetes Dashboard application. The dashboard is an official web-based Kubernetes GUI.

      For a conceptual overview of Helm and its packaging ecosystem, please read our article, An Introduction to Helm.

      Prerequisites

      For this tutorial you will need:

      • A Kubernetes cluster with role-based access control (RBAC) enabled. Helm 3.1 supports clusters from versions 1.14 to 1.17. For further information check the Helm releases page.
      • The kubectl command-line tool installed on your local machine, configured to connect to your cluster. You can read more about installing kubectl in the official documentation.

        You can test your connectivity with the following command:

        If you see no errors, you’re connected to the cluster. If you access multiple clusters with kubectl, be sure to verify that you’ve selected the correct cluster context:

        • kubectl config get-contexts

        Output

        CURRENT NAME CLUSTER AUTHINFO NAMESPACE * do-fra1-helm3-example do-fra1-helm3-example do-fra1-helm3-example-admin

        In this example the asterisk (*) indicates that we are connected to the do-fra1-helm3-example cluster. To switch clusters run:

        • kubectl config use-context context-name

      When you are connected to the correct cluster, continue to Step 1 to begin installing Helm.

      Step 1 — Installing Helm

      First, you’ll install the helm command-line utility on your local machine. Helm provides a script that handles the installation process on MacOS, Windows, or Linux.

      Change to a writable directory and download the script from Helm’s GitHub repository:

      • cd /tmp
      • curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3

      Make the script executable with chmod:

      You can use your favorite text editor to open the script and inspect it to make sure it’s safe. When you are satisfied, run it:

      You may be prompted for your password. Provide it and press ENTER to continue.

      The output will look like this:

      Output

      Downloading https://get.helm.sh/helm-v3.1.2-linux-amd64.tar.gz Preparing to install helm into /usr/local/bin helm installed into /usr/local/bin/helm

      Now that you’ve got Helm installed, you’re ready to use Helm to install your first chart.

      Step 2 — Installing a Helm Chart

      Helm software packages are called charts. There is a curated chart repository called stable, mostly consisting of common charts, which you can see in their GitHub repo. Helm does not come preconfigured for it, so you’ll need to manually add it. Then, as an example, you are going to install the Kubernetes Dashboard.

      Add the stable repo by running:

      • helm repo add stable https://kubernetes-charts.storage.googleapis.com

      The output will be:

      Output

      "stable" has been added to your repositories

      Then, use helm to install the kubernetes-dashboard package from the stable repo:

      • helm install dashboard-demo stable/kubernetes-dashboard --set rbac.clusterAdminRole=true

      The --set parameter lets you to customize chart variables, which the chart exposes to allow you to customize its configuration. Here, you set the rbac.clusterAdminRole variable to true to grant the Kubernetes Dashboard access to your whole cluster.

      The output will look like:

      Output

      NAME: dashboard-demo LAST DEPLOYED: Tue Mar 31 15:04:19 2020 NAMESPACE: default STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: ...

      Notice the NAME line, highlighted in the above example output. In this case, you specified the name dashboard-demo. This is the name of the release. A Helm release is a single deployment of one chart with a specific configuration. You can deploy multiple releases of the same chart, each with its own configuration.

      You can list all the releases in the cluster:

      The output will be similar to this:

      Output

      NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION dashboard-demo default 1 2020-03-31 15:04:19.324774799 +0000 UTC deployed kubernetes-dashboard-1.10.1 1.10.1

      You can now use kubectl to verify that a new service has been deployed on the cluster:

      The output will look like this:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-demo-kubernetes-dashboard ClusterIP 10.245.115.214 <none> 443/TCP 4m44s kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 19m

      Notice that by default, the service name corresponding to the release is a combination of the Helm release name and the chart name.

      Now that you’ve deployed the application, you’ll use Helm to change its configuration and update the deployment.

      Step 3 — Updating a Release

      The helm upgrade command can be used to upgrade a release with a new or updated chart, or update its configuration options (variables).

      You’re going to make a simple change to the dashboard-demo release to demonstrate the update and rollback process: you’ll update the name of the dashboard service to just kubernetes-dashboard, instead of dashboard-demo-kubernetes-dashboard.

      The kubernetes-dashboard chart provides a fullnameOverride configuration option to control the service name. To rename the release, run helm upgrade with this option set:

      • helm upgrade dashboard-demo stable/kubernetes-dashboard --set fullnameOverride="kubernetes-dashboard" --reuse-values

      By passing in the --reuse-values argument, you make sure that chart variables you’ve previously set do not get reset by the upgrade process.

      You’ll see output similar to the initial helm install step.

      Check if your Kubernetes services reflect the updated values:

      The output will look like the following:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 38m kubernetes-dashboard ClusterIP 10.245.49.157 <none> 443/TCP 8s

      Notice that the service name has been updated to the new value.

      Note: At this point you may want to actually load the Kubernetes Dashboard in your browser and check it out. To do so, first run the following command:

      This creates a proxy that lets you access remote cluster resources from your local computer. Based on the previous instructions, your dashboard service is named kubernetes-dashboard and it’s running in the default namespace. You may now access the dashboard at the following URL:

      http://localhost:8001/api/v1/namespaces/default/services/https:kubernetes-dashboard:https/proxy/
      

      Instructions for actually using the dashboard are out of scope for this tutorial, but you can read the official Kubernetes Dashboard docs for more information.

      Next, you’ll have a look at Helm’s ability to roll back and delete releases.

      Step 4 — Rolling Back and Deleting a Release

      When you updated the dashboard-demo release in the previous step, you created a second revision of the release. Helm retains all the details of previous releases in case you need to roll back to a prior configuration or chart.

      Use helm list to inspect the release again:

      You’ll see the following output:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

      The REVISION column tells you that this is now the second revision.

      Use helm rollback to roll back to the first revision:

      • helm rollback dashboard-demo 1

      You should see the following output, indicating that the rollback succeeded:

      Output

      Rollback was a success! Happy Helming!

      At this point, if you run kubectl get services again, you will notice that the service name has changed back to its previous value. Helm has re-deployed the application with revision 1’s configuration.

      Helm releases can be deleted with the helm delete command:

      • helm delete dashboard-demo

      The output will be:

      Output

      release "dashboard-demo" uninstalled

      You can try listing Helm releases:

      You’ll see that there are none:

      Output

      NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION

      Now the release has been truly deleted, and you can reuse the release name.

      Conclusion

      In this tutorial, you installed the helm command-line tool and explored installing, upgrading, rolling back, and deleting Helm charts and releases by managing the kubernetes-dashboard chart.

      For more information about Helm and Helm charts, please see the official Helm documentation.



      Source link

      How To Install Software on Kubernetes Clusters with the Helm Package Manager


      Introdução

      O Helm é um gerenciador de pacotes para o Kubernetes que permite que os desenvolvedores e operadores configurem e implantem mais facilmente aplicativos nos clusters do Kubernetes.

      Neste tutorial, vamos configurar o Helm e usá-lo para instalar, reconfigurar, reverter e então excluir uma instância do aplicativo de painel do Kubernetes. O painel é uma GUI oficial do Kubernetes baseada em Web.

      Para uma visão conceitual do Helm e seu ecossistema de empacotamento, leia nosso artigo Uma introdução ao Helm.

      Pré-requisitos

      Para este tutorial, você precisará de:

      • Um cluster do Kubernetes 1.8+ com controle de acesso baseado na função (RBAC) habilitado
      • A ferramenta kubectl de linha de comando instalada em sua máquina local, configurada para se conectar ao seu cluster. Você pode ler mais sobre como instalar o kubectl na documentação oficial.

      Você pode testar sua conectividade com o seguinte comando:

      Se não houver erros, você está conectado ao cluster. Se acessar vários clusters com o kubectl, certifique-se de verificar se você selecionou o contexto de cluster correto:

      • kubectl config get-contexts

      Output

      CURRENT NAME CLUSTER AUTHINFO NAMESPACE * do-nyc1-k8s-example do-nyc1-k8s-example do-nyc1-k8s-example-admin docker-for-desktop docker-for-desktop-cluster docker-for-desktop

      Neste exemplo, o asterisco (*) indica que estamos conectados ao cluster do-nyc1-k8s-example. Para trocar os clusters execute:

      • kubectl config use-context context-name

      Quando estiver conectado ao cluster correto, continue para o Passo 1 para começar a instalar o Helm.

      Passo 1 — Como instalar o Helm

      Primeiro, vamos instalar o utilitário de linha de comando helm na nossa máquina local. O Helm fornece um script que lida com o processo de instalação no MacOS, Windows ou Linux.

      Mude para um diretório gravável e baixe o script do repositório do GitHub do Helm:

      • cd /tmp
      • curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > install-helm.sh

      Crie o executável do script com o chmod:

      • chmod u+x install-helm.sh

      Neste ponto, você pode usar seu editor de texto favorito para abrir o script e inspecioná-lo para garantir que ele está seguro. Quando estiver satisfeito, execute-o:

      Você pode ser solicitado a colocar sua senha. Digite ela e pressione ENTER.

      Output

      helm installed into /usr/local/bin/helm Run 'helm init' to configure helm.

      Em seguida, vamos concluir a instalação instalando alguns componentes do Helm no nosso cluster.

      Passo 2 — Como instalar o Tiller

      O Tiller é um companheiro do comando helm que é executado no seu cluster, recebendo comandos do helm e se comunicando diretamente com a API do Kubernetes para fazer o trabalho real de criar e excluir recursos. Para dar ao Tiller as permissões que ele precisa para ser executado no cluster, vamos fazer um recurso do Kubernetes, o serviceaccount.

      Nota: vamos ligar esse serviceaccount à função do cluster cluster-admin. Isso dará ao superusuário do serviço tiller acesso ao cluster e permitirá que ele instale todos os tipos de recurso em todos os namespaces. Isso é bom para explorar o Helm, mas você pode querer uma configuração mais fechada para um cluster do Kubernetes de produção.

      Por favor, consulte a documentação oficial do Helm RBAC para mais informações sobre a configuração de diferentes cenários RBAC para o Tiller.

      Crie o tiller serviceaccount:

      • kubectl -n kube-system create serviceaccount tiller

      Em seguida, vincule o tiller serviceaccount à função cluster-admin:

      • kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

      Agora, podemos executar o helm init, que instala o Tiller no nosso cluster, junto com algumas tarefas de organização local, como baixar os detalhes do repositório stable:

      • helm init --service-account tiller

      Output

      . . . Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster. Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy. For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation Happy Helming!

      Para verificar se o Tiller está funcionando, liste os módulos no namespace kube-system:

      • kubectl get pods --namespace kube-system

      Output

      NAME READY STATUS RESTARTS AGE . . . kube-dns-64f766c69c-rm9tz 3/3 Running 0 22m kube-proxy-worker-5884 1/1 Running 1 21m kube-proxy-worker-5885 1/1 Running 1 21m kubernetes-dashboard-7dd4fc69c8-c4gwk 1/1 Running 0 22m tiller-deploy-5c688d5f9b-lccsk 1/1 Running 0 40s

      O nome do módulo do Tiller começa com o prefixo tiller-deploy-.

      Agora que instalamos ambos os componentes do Helm, estamos prontos para usar o helm para instalar nosso primeiro aplicativo.

      Passo 3 — Instalando um chart do Helm

      Os pacotes de software do Helm são chamados de charts. O Helm vem pré-configurado com um repositório de charts coletados chama do stable. Você pode verificar os gráficos disponíveis nos seus repositórios do GitHub. Vamos instalar o Painel do Kubernetes como um exemplo.

      Use o helm para instalar o pacote kubernetes-dashboard do repositório stable:

      • helm install stable/kubernetes-dashboard --name dashboard-demo

      Output

      NAME: dashboard-demo LAST DEPLOYED: Wed Aug 8 20:11:07 2018 NAMESPACE: default STATUS: DEPLOYED . . .

      Observe a linha NAME, em destaque no exemplo de resultado acima. Neste caso, especificamos o nome dashboard-demo. Este é o nome do nosso release. Um release do Helm é uma única implantação de um chart com uma configuração específica. Você pode implantar vários releases do mesmo chart, tendo cada um sua própria configuração.

      Se não especificar seu próprio nome de release usando --name, o Helm criará um nome aleatório para você.

      Podemos pedir ao Helm uma lista de releases neste cluster:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 1 Wed Aug 8 20:11:11 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

      Agora, podemos usar o kubectl para verificar se um novo serviço foi implantado no cluster:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-demo-kubernetes-dashboard ClusterIP 10.32.104.73 <none> 443/TCP 51s kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 34m

      Note que por padrão, o nome de serviço correspondente ao nosso release é uma combinação do nome de release do Helm e o nome do chart.

      Agora que implantamos o aplicativo, vamos usar o Helm para alterar sua configuração e atualizar a implantação.

      Passo 4 — Atualizando um release

      O comando helm upgrade pode ser usado para atualizar um release com um chart novo ou atualizado, ou atualizar as suas opções de configuração.

      Vamos fazer uma alteração simples no nosso release dashboard-demo para demonstrar o processo de atualização e reversão: atualizaremos o nome do serviço do painel para apenas dashboard, em vez de dashboard-demo-kubernetes-dashboard.

      O chart kubernetes-dashboard fornece uma opção de configuração fullnameOverride para controlar o nome do serviço. Vamos executar o helm upgrade com esta opção definida:

      • helm upgrade dashboard-demo stable/kubernetes-dashboard --set fullnameOverride="dashboard"

      Você verá um resultado similar ao passo inicial helm install.

      Verifique se seus serviços do Kubernetes refletem os valores atualizados:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 36m dashboard ClusterIP 10.32.198.148 <none> 443/TCP 40s

      Nosso nome de serviço foi atualizado para o novo valor.

      Nota: neste ponto, você pode carregar o Painel do Kubernetes no seu navegador e verificá-lo. Para fazer isso, execute primeiro o seguinte comando:

      Isso cria um proxy que permite que você acesse recursos de cluster remotos do seu computador local. Baseado nas instruções anteriores, seu serviço de dashboard é chamado kubernetes-dashboard e ele está funcionando no namespace default. Agora, você pode acessar o painel no seguinte URL:

      http://localhost:8001/api/v1/namespaces/default/services/https:dashboard:/proxy/
      

      Se necessário, substitua seu próprio nome de serviço e namespace pelas porções destacadas. As instruções para de fato usar o painel estão fora do escopo deste tutorial, mas você pode ler os docs oficiais do Painel do Kubernetes para mais informações.

      Em seguida, vamos ver a capacidade do Helm para reverter releases.

      Passo 5 — Revertendo um release

      Quando atualizamos nosso release dashboard-demo no passo anterior, criamos uma segunda revision do release. O Helm retém todos os detalhes dos release anteriores caso precise reverter para uma configuração ou chart prévia.

      Use o helm list para verificar o release novamente:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

      A coluna REVISION nos diz que essa é agora a segunda revisão.

      Use o helm rollback para reverter para a primeira revisão:

      • helm rollback dashboard-demo 1

      Você deve ver o seguinte resultado, indicando que a reversão foi bem sucedida:

      Output

      Rollback was a success! Happy Helming!

      Neste ponto, caso execute o kubectl get services novamente, verá que o nome de serviço mudou para seu valor anterior. O Helm reimplantou o aplicativo com a configuração da revisão 1.

      Em seguida, vamos ver como excluir releases com o Helm.

      Passo 6 — Excluindo um release

      Os releases do Helm podem ser excluídos com o comando helm delete:

      • helm delete dashboard-demo

      Output

      release "dashboard-demo" deleted

      Embora o release tenha sido excluído e o aplicativo do painel não esteja mais em funcionamento, o Helm salva todas as informações de revisão caso queira reimplantar o release. Se você tentasse usar o helm install em um novo release dashboard-demo agora, receberia um erro:

      Error: a release named dashboard-demo already exists.
      

      Se você usar a flag --deleted para listar seus releases excluídos, verá que o release ainda está presente:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 3 Wed Aug 8 20:15:21 2018 DELETED kubernetes-dashboard-0.7.1 default

      Para realmente excluir o release e purgar todas as revisões antigas, utilize a flag --purge com o comando helm delete:

      • helm delete dashboard-demo --purge

      Agora, o release foi realmente excluído e você pode reutilizar seu nome.

      Conclusão

      Neste tutorial, instalamos a ferramenta de linha de comando helm e seu serviço companheiro tiller. Também exploramos instalar, atualizar, reverter e excluir charts e releases do Helm.

      Para maiores informações sobre o Helm e charts do Helm, consulte a documentação oficial do Helm.



      Source link

      How To Install Software on Kubernetes Clusters with the Helm Package Manager


      Introduction

      Helm is a package manager for Kubernetes that allows developers and operators to more easily configure and deploy applications on Kubernetes clusters.

      In this tutorial we will set up Helm and use it to install, reconfigure, rollback, then delete an instance of the Kubernetes Dashboard application. The dashboard is an official web-based Kubernetes GUI.

      For a conceptual overview of Helm and its packaging ecosystem, please read our article An Introduction to Helm.

      Prerequisites

      For this tutorial you will need:

      • A Kubernetes 1.8+ cluster with role-based access control (RBAC) enabled.
      • The kubectl command-line tool installed on your local machine, configured to connect to your cluster. You can read more about installing kubectl in the official documentation.

        You can test your connectivity with the following command:

        If you see no errors, you're connected to the cluster. If you access multiple clusters with kubectl, be sure to verify that you've selected the correct cluster context:

        • kubectl config get-contexts

        Output

        CURRENT NAME CLUSTER AUTHINFO NAMESPACE * do-nyc1-k8s-example do-nyc1-k8s-example do-nyc1-k8s-example-admin docker-for-desktop docker-for-desktop-cluster docker-for-desktop

        In this example the asterisk (*) indicates that we are connected to the do-nyc1-k8s-example cluster. To switch clusters run:

        • kubectl config use-context context-name

      When you are connected to the correct cluster, continue to Step 1 to begin installing Helm.

      Step 1 — Installing Helm

      First we'll install the helm command-line utility on our local machine. Helm provides a script that handles the installation process on MacOS, Windows, or Linux.

      Change to a writable directory and download the script from Helm's GitHub repository:

      • cd /tmp
      • curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > install-helm.sh

      Make the script executable with chmod:

      • chmod u+x install-helm.sh

      At this point you can use your favorite text editor to open the script and inspect it to make sure it’s safe. When you are satisfied, run it:

      You may be prompted for your password. Provide it and press ENTER.

      Output

      helm installed into /usr/local/bin/helm Run 'helm init' to configure helm.

      Next we will finish the installation by installing some Helm components on our cluster.

      Step 2 — Installing Tiller

      Tiller is a companion to the helm command that runs on your cluster, receiving commands from helm and communicating directly with the Kubernetes API to do the actual work of creating and deleting resources. To give Tiller the permissions it needs to run on the cluster, we are going to make a Kubernetes serviceaccount resource.

      Note: We will bind this serviceaccount to the cluster-admin cluster role. This will give the tiller service superuser access to the cluster and allow it to install all resource types in all namespaces. This is fine for exploring Helm, but you may want a more locked-down configuration for a production Kubernetes cluster.

      Please refer to the official Helm RBAC documentation for more information on setting up different RBAC scenarios for Tiller.

      Create the tiller serviceaccount:

      • kubectl -n kube-system create serviceaccount tiller

      Next, bind the tiller serviceaccount to the cluster-admin role:

      • kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller

      Now we can run helm init, which installs Tiller on our cluster, along with some local housekeeping tasks such as downloading the stable repo details:

      • helm init --service-account tiller

      Output

      . . . Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster. Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy. For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation Happy Helming!

      To verify that Tiller is running, list the pods in thekube-system namespace:

      • kubectl get pods --namespace kube-system

      Output

      NAME READY STATUS RESTARTS AGE . . . kube-dns-64f766c69c-rm9tz 3/3 Running 0 22m kube-proxy-worker-5884 1/1 Running 1 21m kube-proxy-worker-5885 1/1 Running 1 21m kubernetes-dashboard-7dd4fc69c8-c4gwk 1/1 Running 0 22m tiller-deploy-5c688d5f9b-lccsk 1/1 Running 0 40s

      The Tiller pod name begins with the prefix tiller-deploy-.

      Now that we've installed both Helm components, we're ready to use helm to install our first application.

      Step 3 — Installing a Helm Chart

      Helm software packages are called charts. Helm comes preconfigured with a curated chart repository called stable. You can browse the available charts in their GitHub repo. We are going to install the Kubernetes Dashboard as an example.

      Use helm to install the kubernetes-dashboard package from the stable repo:

      • helm install stable/kubernetes-dashboard --name dashboard-demo

      Output

      NAME: dashboard-demo LAST DEPLOYED: Wed Aug 8 20:11:07 2018 NAMESPACE: default STATUS: DEPLOYED . . .

      Notice the NAME line, highlighted in the above example output. In this case we specified the name dashboard-demo. This is the name of our release. A Helm release is a single deployment of one chart with a specific configuration. You can deploy multiple releases of the same chart with, each with its own configuration.

      If you don't specify your own release name using --name, Helm will create a random name for you.

      We can ask Helm for a list of releases on this cluster:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 1 Wed Aug 8 20:11:11 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

      We can now use kubectl to verify that a new service has been deployed on the cluster:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-demo-kubernetes-dashboard ClusterIP 10.32.104.73 <none> 443/TCP 51s kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 34m

      Notice that by default the service name corresponding to our release is a combination of the Helm release name and the chart name.

      Now that we've deployed the application, let's use Helm to change its configuration and update the deployment.

      Step 4 — Updating a Release

      The helm upgrade command can be used to upgrade a release with a new or updated chart, or update the it’s configuration options.

      We're going to make a simple change to our dashboard-demo release to demonstrate the update and rollback process: we'll update the name of the dashboard service to just dashboard, instead of dashboard-demo-kubernetes-dashboard.

      The kubernetes-dashboard chart provides a fullnameOverride configuration option to control the service name. Let's run helm upgrade with this option set:

      • helm upgrade dashboard-demo stable/kubernetes-dashboard --set fullnameOverride="dashboard"

      You'll see output similar to the initial helm install step.

      Check if your Kubernetes services reflect the updated values:

      Output

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.32.0.1 <none> 443/TCP 36m dashboard ClusterIP 10.32.198.148 <none> 443/TCP 40s

      Our service name has been updated to the new value.

      Note: At this point you may want to actually load the Kubernetes Dashboard in your browser and check it out. To do so, first run the following command:

      This creates a proxy that lets you access remote cluster resources from your local computer. Based on the previous instructions your dashboard service is named kubernetes-dashboard and it's running in the default namespace. You may now access the dashboard at the following url:

      http://localhost:8001/api/v1/namespaces/default/services/https:dashboard:/proxy/
      

      If necessary, substitute your own service name and namespace for the highlighted portions. Instructions for actually using the dashboard are out of scope for this tutorial, but you can read the official Kubernetes Dashboard docs for more information.

      Next we'll look at Helm's ability to roll back releases.

      Step 5 — Rolling Back a Release

      When we updated our dashboard-demo release in the previous step, we created a second revision of the release. Helm retains all the details of previous releases in case you need to roll back to a prior configuration or chart.

      Use helm list to inspect the release again:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default

      The REVISION column tells us that this is now the second revision.

      Use helm rollback to roll back to the first revision:

      • helm rollback dashboard-demo 1

      You should see the following output, indicating that the rollback succeeded:

      Output

      Rollback was a success! Happy Helming!

      At this point, if you run kubectl get services again, you will notice that the service name has changed back to its previous value. Helm has re-deployed the application with revision 1's configuration.

      Next we'll look into deleting releases with Helm.

      Step 6 — Deleting a Release

      Helm releases can be deleted with the helm delete command:

      • helm delete dashboard-demo

      Output

      release "dashboard-demo" deleted

      Though the release has been deleted and the dashboard application is no longer running, Helm saves all the revision information in case you want to re-deploy the release. If you tried to helm install a new dashboard-demo release right now, you'd get an error:

      Error: a release named dashboard-demo already exists.
      

      If you use the --deleted flag to list your deleted releases, you'll see that the release is still around:

      Output

      NAME REVISION UPDATED STATUS CHART NAMESPACE dashboard-demo 3 Wed Aug 8 20:15:21 2018 DELETED kubernetes-dashboard-0.7.1 default

      To really delete the release and purge all old revisions, use the --purge flag with the helm delete command:

      • helm delete dashboard-demo --purge

      Now the release has been truly deleted, and you can reuse the release name.

      Conclusion

      In this tutorial we installed the helm command-line tool and its tiller companion service. We also explored installing, upgrading, rolling back, and deleting Helm charts and releases.

      For more information about Helm and Helm charts, please see the official Helm documentation.



      Source link