GGG

プログラミング言語やソフトウェア開発について思ったことを書いてます

helm 入門(kubernetes)

以下のサイトを参考に作業してみた。 helmとはどんなものかは、さわってみた qiita.com

前提条件

  • mac
  • minikube
  • kubernetes

mac os

kubernetes version

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T20:00:41Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"dirty", BuildDate:"2017-10-17T15:09:55Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

minikube version

 $ minikube version
minikube version: v0.23.0

手順

brew install

$ brew install kubernetes-helm

helm init

$ Helm init

Creating /Users/<user>/.helm 
Creating /Users/<user>/.helm/repository 
Creating /Users/<user>/.helm/repository/cache 
Creating /Users/<user>/.helm/repository/local 
Creating /Users/<user>/.helm/plugins 
Creating /Users/<user>/.helm/starters 
Creating /Users/<user>/.helm/cache/archive 
Creating /Users/<user>/.helm/repository/repositories.yaml 
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com 
Adding local repo with URL: http://127.0.0.1:8879/charts 
$HELM_HOME has been configured at /Users/<user>/.helm.

Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Happy Helming!

確認: tilter

$ kubectl get pods --all-namespaces | grep tiller 
kube-system   tiller-deploy-5b9d65c7f-xsz6k   1/1       Running   0          18m

確認 helm version

$ helm version
Client: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.7.2", GitCommit:"8478fb4fc723885b155c924d1c8c410b7a9444e6", GitTreeState:"clean"}

確認:stableのパッケージ一覧

 helm search
NAME                            VERSION DESCRIPTION                                       
stable/acs-engine-autoscaler    2.1.1   Scales worker nodes within agent pools            
stable/aerospike                0.1.5   A Helm chart for Aerospike in Kubernetes          
stable/artifactory              6.2.4   Universal Repository Manager supporting all maj...
stable/aws-cluster-autoscaler   0.3.2   Scales worker nodes within autoscaling groups.    
stable/buildkite                0.2.0   Agent for Buildkite                               
stable/centrifugo               2.0.0   Centrifugo is a real-time messaging server.       
stable/chaoskube                0.6.1   Chaoskube periodically kills random pods in you...
stable/chronograf               0.4.0   Open-source web application written in Go and R...
stable/cluster-autoscaler       0.3.1   Scales worker nodes within autoscaling groups.    
stable/cockroachdb              0.5.4   CockroachDB is a scalable, survivable, strongly...
stable/concourse                0.10.8  Concourse is a simple and scalable CI system.     
stable/consul                   1.1.3   Highly available and distributed service discov...
stable/coredns                  0.8.0   CoreDNS is a DNS server that chains plugins and...
stable/coscale                  0.2.0   CoScale Agent                                     
stable/dask-distributed         2.0.0   Distributed computation in Python                 
stable/datadog                  0.10.3  DataDog Agent                                     
stable/docker-registry          1.0.0   A Helm chart for Docker Registry                  
stable/dokuwiki                 0.2.1   DokuWiki is a standards-compliant, simple to us...
stable/drupal                   0.11.3  One of the most versatile open source content m...
stable/elastalert               0.1.0   ElastAlert is a simple framework for alerting o...
stable/etcd-operator            0.6.2   CoreOS etcd-operator Helm chart for Kubernetes    
stable/external-dns             0.4.4   Configure external DNS servers (AWS Route53, Go...
stable/factorio                 0.3.0   Factorio dedicated server.                        
stable/fluent-bit               0.2.4   Fast and Lightweight Log/Data Forwarder for Lin...
stable/g2                       0.2.0   G2 by AppsCode - Gearman in Golang                
stable/gcloud-endpoints         0.1.0   Develop, deploy, protect and monitor your APIs ...
stable/gcloud-sqlproxy          0.2.2   Google Cloud SQL Proxy                            
stable/ghost                    2.1.7   A simple, powerful publishing platform that all...
stable/gitlab-ce                0.2.1   GitLab Community Edition                          
stable/gitlab-ee                0.2.1   GitLab Enterprise Edition                         
stable/grafana                  0.5.4   The leading tool for querying and visualizing t...
stable/hadoop                   1.0.1   The Apache Hadoop software library is a framewo...
stable/heapster                 0.2.4   Heapster enables Container Cluster Monitoring a...
stable/influxdb                 0.8.0   Scalable datastore for metrics, events, and rea...
stable/ipfs                     0.2.0   A Helm chart for the Interplanetary File System   
stable/jasperreports            0.2.3   The JasperReports server can be used as a stand...
stable/jenkins                  0.11.0  Open source continuous integration server. It s...
stable/joomla                   0.5.4   PHP content management system (CMS) for publish...
stable/kapacitor                0.5.0   InfluxDB's native data processing engine. It ca...
stable/keel                     0.2.0   Open source, tool for automating Kubernetes dep...
stable/kibana                   0.2.0   Kibana is an open source data visualization plu...
stable/kube-lego                0.3.0   Automatically requests certificates from Let's ...
stable/kube-ops-view            0.4.1   Kubernetes Operational View - read-only system ...
stable/kube-state-metrics       0.5.1   Install kube-state-metrics to generate and expo...
stable/kube2iam                 0.6.1   Provide IAM credentials to pods based on annota...
stable/kubed                    0.1.0   Kubed by AppsCode - Kubernetes daemon             
stable/kubernetes-dashboard     0.4.3   General-purpose web UI for Kubernetes clusters    
stable/lamp                     0.1.0   Modular and transparent LAMP stack chart suppor...
stable/linkerd                  0.4.0   Service mesh for cloud native apps                
stable/locust                   0.1.2   A modern load testing framework                   
stable/magento                  0.5.2   A feature-rich flexible e-commerce solution. It...
stable/mailhog                  2.0.0   An e-mail testing tool for developers             
stable/mariadb                  2.1.3   Fast, reliable, scalable, and easy to use open-...
stable/mcrouter                 0.1.0   Mcrouter is a memcached protocol router for sca...
stable/mediawiki                0.6.1   Extremely powerful, scalable software and a fea...
stable/memcached                2.0.1   Free & open source, high-performance, distribut...
stable/metabase                 0.3.0   The easy, open source way for everyone in your ...
stable/minecraft                0.2.0   Minecraft server                                  
stable/minio                    0.4.3   Distributed object storage server built for clo...
stable/mongodb                  0.4.22  NoSQL document-oriented database that stores JS...
stable/mongodb-replicaset       2.1.4   NoSQL document-oriented database that stores JS...
stable/moodle                   0.4.1   Moodle is a learning platform designed to provi...
stable/msoms                    0.1.1   A chart for deploying omsagent as a daemonset K...
stable/mysql                    0.3.4   Fast, reliable, scalable, and easy to use open-...
stable/namerd                   0.2.0   Service that manages routing for multiple linke...
stable/neo4j                    0.4.0   Neo4j is the world's leading graph database       
stable/newrelic-infrastructure  0.0.1   A Helm chart to deploy the New Relic Infrastruc...
stable/nginx-ingress            0.8.22  An nginx Ingress controller that uses ConfigMap...
stable/nginx-lego               0.3.0   Chart for nginx-ingress-controller and kube-lego  
stable/odoo                     0.7.0   A suite of web based open source business apps.   
stable/opencart                 0.6.0   A free and open source e-commerce platform for ...
stable/openvpn                  2.0.2   A Helm chart to install an openvpn server insid...
stable/orangehrm                0.5.0   OrangeHRM is a free HR management system that o...
stable/osclass                  0.5.0   Osclass is a php script that allows you to quic...
stable/owncloud                 0.5.3   A file sharing server that puts the control and...
stable/pachyderm                0.1.1   Pachyderm is a large-scale container-based work...
stable/parse                    0.3.2   Parse is a platform that enables users to add a...
stable/percona                  0.3.0   free, fully compatible, enhanced, open source d...
stable/phabricator              0.5.5   Collection of open source web applications that...
stable/phpbb                    0.6.0   Community forum that supports the notion of use...
stable/postgresql               0.8.5   Object-relational database management system (O...
stable/prestashop               0.5.3   A popular open source ecommerce solution. Profe...
stable/prometheus               4.6.16  Prometheus is a monitoring system and time seri...
stable/prometheus-to-sd         0.1.0   Scrape metrics stored in prometheus format and ...
stable/rabbitmq                 0.6.14  Open source message broker software that implem...
stable/rabbitmq-ha              0.1.1   Highly available RabbitMQ cluster, the open sou...
stable/redis                    1.1.5   Open source, advanced key-value store. It is of...
stable/redis-ha                 2.0.0   Highly available Redis cluster with multiple se...
stable/redmine                  2.0.1   A flexible project management web application.    
stable/rethinkdb                0.1.0   The open-source database for the realtime web     
stable/risk-advisor             2.0.0   Risk Advisor add-on module for Kubernetes         
stable/rocketchat               0.1.2   Prepare to take off with the ultimate chat plat...
stable/sapho                    0.2.1   A micro application development and integration...
stable/searchlight              0.1.0   Searchlight by AppsCode - Alerts for Kubernetes   
stable/selenium                 0.2.5   Chart for selenium grid                           
stable/sensu                    0.2.0   Sensu monitoring framework backed by the Redis ...
stable/sentry                   0.1.7   Sentry is a cross-platform crash reporting and ...
stable/sonarqube                0.3.2   Sonarqube is an open sourced code quality scann...
stable/sonatype-nexus           0.1.6   Sonatype Nexus is an open source repository man...
stable/spark                    0.1.6   Fast and general-purpose cluster computing system.
stable/spartakus                1.1.3   Collect information about Kubernetes clusters t...
stable/spinnaker                0.3.10  Open source, multi-cloud continuous delivery pl...
stable/spotify-docker-gc        0.1.1   A simple Docker container and image garbage col...
stable/stash                    0.2.0   Stash by AppsCode - Backup your Kubernetes Volumes
stable/sugarcrm                 0.2.2   SugarCRM enables businesses to create extraordi...
stable/suitecrm                 0.3.2   SuiteCRM is a completely open source enterprise...
stable/sumokube                 0.1.1   Sumologic Log Collector                           
stable/sumologic-fluentd        0.2.1   Sumologic Log Collector                           
stable/swift                    0.2.0   swift by AppsCode - Ajax friendly Helm Tiller P...
stable/sysdig                   0.4.0   Sysdig Monitor and Secure agent                   
stable/telegraf                 0.3.0   Telegraf is an agent written in Go for collecti...
stable/testlink                 0.4.16  Web-based test management system that facilitat...
stable/traefik                  1.15.2  A Traefik based Kubernetes ingress controller w...
stable/uchiwa                   0.2.2   Dashboard for the Sensu monitoring framework      
stable/verdaccio                0.1.2   A lightweight private npm proxy registry (sinop...
stable/voyager                  2.0.0   Voyager by AppsCode - Secure Ingress Controller...
stable/weave-cloud              0.1.2   Weave Cloud is a add-on to Kubernetes which pro...
stable/weave-scope              0.9.1   A Helm chart for the Weave Scope cluster visual...
stable/wordpress                0.7.9   Web publishing platform for building blogs and ...
stable/zeppelin                 1.0.0   Web-based notebook that enables data-driven, in...
stable/zetcd                    0.1.4   CoreOS zetcd Helm chart for Kubernetes    

install

$ helm install stable/redis-ha
NAME:   agile-guppy
LAST DEPLOYED: Mon Jan  8 18:01:54 2018
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Service
NAME                             TYPE       CLUSTER-IP  EXTERNAL-IP  PORT(S)    AGE
agile-guppy-redis-ha-master-svc  ClusterIP  10.0.0.189  <none>       6379/TCP   2s
agile-guppy-redis-ha-sentinel    ClusterIP  10.0.0.198  <none>       26379/TCP  2s
agile-guppy-redis-ha-slave-svc   ClusterIP  10.0.0.61   <none>       6379/TCP   2s

==> v1beta1/Deployment
NAME                           DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
agile-guppy-redis-ha-sentinel  3        3        3           0          2s
agile-guppy-redis-ha-server    3        3        3           0          2s

==> v1/Pod(related)
NAME                                            READY  STATUS             RESTARTS  AGE
agile-guppy-redis-ha-sentinel-55b94ddd8c-5nxsg  0/1    ContainerCreating  0         2s
agile-guppy-redis-ha-sentinel-55b94ddd8c-9kscd  0/1    ContainerCreating  0         2s
agile-guppy-redis-ha-sentinel-55b94ddd8c-9qfk4  0/1    ContainerCreating  0         2s
agile-guppy-redis-ha-server-d474fdb7-25b7x      0/1    Pending            0         2s
agile-guppy-redis-ha-server-d474fdb7-g27gq      0/1    ContainerCreating  0         2s
agile-guppy-redis-ha-server-d474fdb7-m2kxw      0/1    ContainerCreating  0         2s


NOTES:
Redis cluster can be accessed via port 6379 on the following DNS name from within your cluster:
agile-guppy-redis-ha.default.svc.cluster.local

To connect to your Redis server:

1. Run a Redis pod that you can use as a client:

   kubectl exec -it agile-guppy-redis-ha-master-0 bash

2. Connect using the Redis CLI:

  redis-cli -h agile-guppy-redis-ha.default.svc.cluster.local

List

$ helm list                                                                                                              
NAME        REVISION    UPDATED                     STATUS      CHART           NAMESPACE
agile-guppy 1           Mon Jan  8 18:01:54 2018    DEPLOYED    redis-ha-2.0.0  default  

確認pods

kubectl get pods --show-labels                                                                                         
NAME                                             READY     STATUS    RESTARTS   AGE       LABELS
agile-guppy-redis-ha-sentinel-55b94ddd8c-5nxsg   1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=agile-guppy-redis-ha-sentinel,pod-template-hash=1165088847,podIP=172.17.0.7,redis-role=sentinel,release=agile-guppy
agile-guppy-redis-ha-sentinel-55b94ddd8c-9kscd   1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=agile-guppy-redis-ha-sentinel,pod-template-hash=1165088847,podIP=172.17.0.8,redis-role=sentinel,release=agile-guppy
agile-guppy-redis-ha-sentinel-55b94ddd8c-9qfk4   1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=agile-guppy-redis-ha-sentinel,pod-template-hash=1165088847,podIP=172.17.0.6,redis-role=sentinel,release=agile-guppy
agile-guppy-redis-ha-server-d474fdb7-25b7x       1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=redis-server,pod-template-hash=80309863,podIP=172.17.0.9,redis-node=true,redis-role=master,release=agile-guppy,runID=fe5a64
agile-guppy-redis-ha-server-d474fdb7-g27gq       1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=redis-server,pod-template-hash=80309863,podIP=172.17.0.11,redis-node=true,redis-role=slave,release=agile-guppy,runID=7781d7
agile-guppy-redis-ha-server-d474fdb7-m2kxw       1/1       Running   0          2h        app=redis-ha,chart=redis-ha-2.0.0,heritage=Tiller,name=redis-server,pod-template-hash=80309863,podIP=172.17.0.10,redis-node=true,redis-role=slave,release=agile-guppy,runID=69b5f2

Delete

$ helm delete agile-guppy
release "agile-guppy" deleted

最後に

  • 参考URLでは独自パッケージ作成をやっているため、そのうちやってみたい。

簡単にredis-ha をデプロイすることができた。

仕事でkubernetesを使っているが、自分で構築した時にそこそこ時間がかかったのを覚えてる。 これだけ簡単にデプロイできるなら選択肢としてもありかも?

もう少し検証した上で採用までもっていけるか判断したいなと思いました。 設定項目はとても参考になりそうです。こちらももう少し掘り下げて行きたい。