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
metadata:
  name: tiller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: tiller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
  - kind: ServiceAccount
    name: tiller
    namespace: kube-system
__EOF__

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

Download the helm package.
root@kub-master:~# root@kub-master:~# wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
--2020-01-27 17:21:03--  https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz
Resolving storage.googleapis.com (storage.googleapis.com)... 172.217.194.128, 2404:6800:4003:c03::80
Connecting to storage.googleapis.com (storage.googleapis.com)|172.217.194.128|: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
linux-amd64/
linux-amd64/README.md
linux-amd64/helm
linux-amd64/LICENSE
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: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$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: https://docs.helm.sh/using_helm/#securing-your-helm-installation
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   10.96.0.1       <none>        443/TCP                  4h33m
default       service/nginx           NodePort    10.96.121.113   <none>        80:30080/TCP             3h26m
kube-system   service/kube-dns        ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   4h33m
kube-system   service/tiller-deploy   ClusterIP   10.107.143.64   <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           beta.kubernetes.io/os=linux   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...