Installing and working with helm

Download required version of Helm

wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.0-linux-amd64.tar.gz

tar -zxvf helm-v2.13.0-linux-amd64.tar.gz

mv linux-amd64/helm /usr/local/bin/helm

[root@remoteuser ~]# helm
The Kubernetes package manager

To begin working with Helm, run the ‘helm init’ command:

$ helm init

This will install Tiller to your running Kubernetes cluster.
It will also set up any necessary local configuration.

Common actions from this point include:

– helm search: search for charts
– helm fetch: download a chart to your local directory to view
– helm install: upload the chart to Kubernetes
– helm list: list releases of charts

Environment:
$HELM_HOME set an alternative location for Helm files. By default, these are stored in ~/.helm
$HELM_HOST set an alternative Tiller host. The format is host:port
$HELM_NO_PLUGINS disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins.
$TILLER_NAMESPACE set an alternative Tiller namespace (default “kube-system”)
$KUBECONFIG set an alternative Kubernetes configuration file (default “~/.kube/config”)
$HELM_TLS_CA_CERT path to TLS CA certificate used to verify the Helm client and Tiller server certificates (default “$HELM_HOME/ca.pem”)
$HELM_TLS_CERT path to TLS client certificate file for authenticating to Tiller (default “$HELM_HOME/cert.pem”)
$HELM_TLS_KEY path to TLS client key file for authenticating to Tiller (default “$HELM_HOME/key.pem”)
$HELM_TLS_ENABLE enable TLS connection between Helm and Tiller (default “false”)
$HELM_TLS_VERIFY enable TLS connection between Helm and Tiller and verify Tiller server certificate (default “false”)
$HELM_TLS_HOSTNAME the hostname or IP address used to verify the Tiller server certificate (default “127.0.0.1”)
$HELM_KEY_PASSPHRASE set HELM_KEY_PASSPHRASE to the passphrase of your PGP private key. If set, you will not be prompted for
the passphrase while signing helm charts

Usage:
helm [command]

Available Commands:
completion Generate autocompletions script for the specified shell (bash or zsh)
create create a new chart with the given name
delete given a release name, delete the release from Kubernetes
dependency manage a chart’s dependencies
fetch download a chart from a repository and (optionally) unpack it in local directory
get download a named release
help Help about any command
history fetch release history
home displays the location of HELM_HOME
init initialize Helm on both client and server
inspect inspect a chart
install install a chart archive
lint examines a chart for possible issues
list list releases
package package a chart directory into a chart archive
plugin add, list, or remove Helm plugins
repo add, list, remove, update, and index chart repositories
reset uninstalls Tiller from a cluster
rollback roll back a release to a previous revision
search search for a keyword in charts
serve start a local http web server
status displays the status of the named release
template locally render templates
test test a release
upgrade upgrade a release
verify verify that a chart at the given path has been signed and is valid
version print the client/server version information

Flags:
–debug enable verbose output
-h, –help help for helm
–home string location of your Helm config. Overrides $HELM_HOME (default “/root/.helm”)
–host string address of Tiller. Overrides $HELM_HOST
–kube-context string name of the kubeconfig context to use
–kubeconfig string absolute path to the kubeconfig file to use
–tiller-connection-timeout int the duration (in seconds) Helm will wait to establish a connection to tiller (default 300)
–tiller-namespace string namespace of Tiller (default “kube-system”)

Use “helm [command] –help” for more information about a command.

helm init
Creating /home/mshaik/.helm
Creating /home/mshaik/.helm/repository
Creating /home/mshaik/.helm/repository/cache
Creating /home/mshaik/.helm/repository/local
Creating /home/mshaik/.helm/plugins
Creating /home/mshaik/.helm/starters
Creating /home/mshaik/.helm/cache/archive
Creating /home/mshaik/.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 /home/mshaikgspann/.helm.

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.
To prevent this, run `helm init` with the –tiller-tls-verify flag.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!

helm list
Error: Get http://localhost:8080/api/v1/namespaces/kube-system/pods?labelSelector=app%3Dhelm%2Cname%3Dtiller: dial tcp 127.0.0.1:8080: connect: connection refused

kubectl get pod -n kube-system | grep tiller
tiller-deploy-779fc67b76-48xtx 1/1 Running 0 1d

helm ls
Error: configmaps is forbidden: User “system:serviceaccount:kube-system:default” cannot list configmaps in the namespace “kube-system”

https://stackoverflow.com/questions/46672523/helm-list-cannot-list-configmaps-in-the-namespace-kube-system

kubectl apply -f your-config-file-name.yaml
serviceaccount “tiller” created
clusterrolebinding.rbac.authorization.k8s.io “tiller” created

kubectl delete deployment tiller-deploy –namespace kube-system

helm init –force-upgrade

helm init –upgrade
$HELM_HOME has been configured at /home/mshaikgspann/.helm.
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!

helm init –service-account tiller –upgrade
$HELM_HOME has been configured at /home/mshaikgspann/.helm.
Tiller (the Helm server-side component) has been upgraded to the current version.
Happy Helming!

helm install stable/mysql –name=testing-mysql
NAME: testing-mysql
LAST DEPLOYED: Fri Mar 8 19:23:02 2019
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/ConfigMap
NAME DATA AGE
testing-mysql-test 1 2s

==> v1/PersistentVolumeClaim
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
testing-mysql Pending standard 2s

==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
testing-mysql-68b95d6d5b-bql8x 0/1 Pending 0 1s

==> v1/Secret
NAME TYPE DATA AGE
testing-mysql Opaque 2 2s

==> v1/Service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
testing-mysql ClusterIP 10.27.248.238 3306/TCP 2s

==> v1beta1/Deployment
NAME READY UP-TO-DATE AVAILABLE AGE
testing-mysql 0/1 1 0 2s

NOTES:
MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
testing-mysql.default.svc.cluster.local

To get your root password run:

MYSQL_ROOT_PASSWORD=$(kubectl get secret –namespace default testing-mysql -o jsonpath=”{.data.mysql-root-password}” | base64 –decode; echo)

To connect to your database:

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

kubectl run -i –tty ubuntu –image=ubuntu:16.04 –restart=Never — bash -il

2. Install the mysql client:

$ apt-get update && apt-get install mysql-client -y

3. Connect using the mysql cli, then provide your password:
$ mysql -h testing-mysql -p

To connect to your database directly from outside the K8s cluster:
MYSQL_HOST=127.0.0.1
MYSQL_PORT=3306

# Execute the following command to route the connection:
kubectl port-forward svc/testing-mysql 3306

mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}

helm list
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
testing-mysql 1 Fri Mar 8 19:23:02 2019 DEPLOYED mysql-0.15.0 5.7.14 default

kubectl get pods
NAME READY STATUS RESTARTS AGE
testing-mysql-68b95d6d5b-bql8x 1/1 Running 0 5m

 

Leave a comment