Monday, January 27, 2020

Install and configure Helm in Kubernetes

Helm is a great way to install new services in Kubernetes and it can be used to run custom services as well. Helm works as a package manager service that is used to deploy the applications in versioned and preconfigured way.

Create an RBAC configuration to provide admin access to Helm.
root@kub-master:~# cat <<__EOF__>~/helm-rbac.yaml
apiVersion: v1
kind: ServiceAccount
  name: tiller
  namespace: kube-system
kind: ClusterRoleBinding
  name: tiller
  kind: ClusterRole
  name: cluster-admin
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system

Create the RBAC rule on your cluster.
root@kub-master:~# kubectl create -f helm-rbac.yaml
serviceaccount/tiller created created

Download the helm package.
root@kub-master:~# root@kub-master:~# wget
--2020-01-27 17:21:03--
Resolving (, 2404:6800:4003:c03::80
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9160761 (8.7M) [application/x-tar]
Saving to: ‘helm-v2.9.1-linux-amd64.tar.gz’

helm-v2.9.1-linux-amd64.tar.gz                     100%[================================================================================================================>]   8.74M  17.3MB/s    in 0.5s

2020-01-27 17:21:04 (17.3 MB/s) - ‘helm-v2.9.1-linux-amd64.tar.gz’ saved [9160761/9160761]

Extract and copy the binary to executable path.
root@kub-master:~# tar -xvzf helm-v2.9.1-linux-amd64.tar.gz
root@kub-master:~# cp linux-amd64/helm /usr/local/bin/
root@kub-master:~# helm version
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}

Initial the tiller to complete the setup of Helm.
root@kub-master:~# helm init --service-account tiller --tiller-namespace kube-system
Creating /root/.helm
Creating /root/.helm/repository
Creating /root/.helm/repository/cache
Creating /root/.helm/repository/local
Creating /root/.helm/plugins
Creating /root/.helm/starters
Creating /root/.helm/cache/archive
Creating /root/.helm/repository/repositories.yaml
Adding stable repo with URL:
Adding local repo with URL:
$HELM_HOME has been configured at /root/.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.
For more information on securing your installation see:
Happy Helming!

Check if tiller is installed an running successfully.
root@kub-master:~# kubectl get all --all-namespaces
NAMESPACE     NAME                                                  READY   STATUS    RESTARTS   AGE
default       pod/nginx-deployment-5b44794677-dlv5p                 1/1     Running   0          3h26m
default       pod/nginx-deployment-5b44794677-hdj9n                 1/1     Running   0          3h26m
default       pod/nginx-deployment-5b44794677-r2gbd                 1/1     Running   0          3h26m
kube-system   pod/coredns-5c98db65d4-k77mn                          1/1     Running   0          4h33m
kube-system   pod/coredns-5c98db65d4-mv7p9                          1/1     Running   0          4h33m
kube-system   pod/etcd-izt4nicu8fd63j4cm5tj1uz                      1/1     Running   0          4h32m
kube-system   pod/kube-apiserver-izt4nicu8fd63j4cm5tj1uz            1/1     Running   0          4h32m
kube-system   pod/kube-controller-manager-izt4nicu8fd63j4cm5tj1uz   1/1     Running   0          4h32m
kube-system   pod/kube-flannel-ds-amd64-gfct6                       1/1     Running   0          4h15m
kube-system   pod/kube-flannel-ds-amd64-l8ts5                       1/1     Running   0          20m
kube-system   pod/kube-flannel-ds-amd64-rdlfc                       1/1     Running   0          20m
kube-system   pod/kube-flannel-ds-amd64-tx8dm                       1/1     Running   1          4h8m
kube-system   pod/kube-proxy-8958c                                  1/1     Running   0          20m
kube-system   pod/kube-proxy-fthqr                                  1/1     Running   0          20m
kube-system   pod/kube-proxy-jgql9                                  1/1     Running   0          4h33m
kube-system   pod/kube-proxy-jh6m8                                  1/1     Running   0          4h8m
kube-system   pod/kube-scheduler-izt4nicu8fd63j4cm5tj1uz            1/1     Running   0          4h32m
kube-system   pod/tiller-deploy-788b748dc8-grspx                    1/1     Running   0          30s

NAMESPACE     NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes      ClusterIP       <none>        443/TCP                  4h33m
default       service/nginx           NodePort   <none>        80:30080/TCP             3h26m
kube-system   service/kube-dns        ClusterIP      <none>        53/UDP,53/TCP,9153/TCP   4h33m
kube-system   service/tiller-deploy   ClusterIP   <none>        44134/TCP                30s

NAMESPACE     NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR                 AGE
kube-system   daemonset.apps/kube-flannel-ds-amd64     4         4         4       4            4           <none>                        4h15m
kube-system   daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0           <none>                        4h15m
kube-system   daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0           <none>                        4h15m
kube-system   daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0           <none>                        4h15m
kube-system   daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0           <none>                        4h15m
kube-system   daemonset.apps/kube-proxy                4         4         4       4            4    4h33m

NAMESPACE     NAME                               READY   UP-TO-DATE   AVAILABLE   AGE
default       deployment.apps/nginx-deployment   3/3     3            3           3h26m
kube-system   deployment.apps/coredns            2/2     2            2           4h33m
kube-system   deployment.apps/tiller-deploy      1/1     1            1           30s

NAMESPACE     NAME                                          DESIRED   CURRENT   READY   AGE
default       replicaset.apps/nginx-deployment-5b44794677   3         3         3       3h26m
kube-system   replicaset.apps/coredns-5c98db65d4            2         2         2       4h33m
kube-system   replicaset.apps/tiller-deploy-788b748dc8      1         1         1       30s

No comments:

Post a Comment

Setup fully configurable EFK Elasticsearch Fluentd Kibana setup in Kubernetes

In the following setup, we will be creating a fully configurable Elasticsearch, Flunetd, Kibana setup better known as EKF setup. There is a...