Menginstall Rancher pada Kubernetes mempermudah pengelolaan dan orkestrasi cluster Kubernetes. Berikut adalah langkah-langkah singkat untuk menginstal Rancher:

  1. Persiapkan Cluster Kubernetes: Pastikan cluster Kubernetes sudah aktif dan dapat diakses. Rancher memerlukan cluster dengan versi Kubernetes yang didukung.
  2. Unduh Rancher Manifest: Dapatkan file manifest terbaru dari Rancher dengan menggunakan perintah kubectl:

Instalasi Helm

sudo curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
sudo chmod 700 get_helm.sh
sudo ./get_helm.sh
admin@master01:~$ sudo curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
[sudo] password for masadmin:
admin@master01:~$
admin@master01:~$ ls -l
total 100396
-rw-rw-r--  1 admin    admin       68 Aug 13 06:24 cert-manager-backup.yaml
-rwxr-xr-x  1 root     root          648 Aug 13 06:34 cert.sh
-rw-------  1 admin    admin   123345 Aug 21 01:59 cluster.rkestate
-rw-r-----  1 admin    admin     4622 Aug 21 01:58 cluster.yml
-rw-r--r--  1 root     root        11694 Aug 21 14:42 get_helm.sh
drwxr-xr-x  2 root     root         4096 Jun 20 15:30 master
admin@master01:~$
admin@master01:~$ sudo chmod 700 get_helm.sh
admin@master01:~$
admin@master01:~$ sudo chmod 700 get_helm.sh
admin@master01:~$ sudo ./get_helm.sh
Downloading https://get.helm.sh/helm-v3.15.4-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
admin@master01:~$

Check version

helm version
admin@master01:~$ helm version
version.BuildInfo{Version:"v3.15.4", GitCommit:"fa9efb07d9d8debbb4306d72af76a383895aa8c4", GitTreeState:"clean", GoVersion:"go1.22.6"}
admin@master01:~$

Menambahkan helm repository

helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
helm repo add jetstack https://charts.jetstack.io

helm repo update
admin@master01:~$ helm repo add rancher-latest https://releases.rancher.com/server-charts/stable
"rancher-stable" has been added to your repositories
masadmin@master01:~$ helm repo add jetstack https://charts.jetstack.io
"jetstack" has been added to your repositories
admin@master01:~$
admin@master01:~$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "jetstack" chart repository
...Successfully got an update from the "rancher-stable" chart repository
Update Complete. ⎈Happy Helming!⎈
admin@master01:~$

Install cert manager

kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.1/cert-manager.crds.yaml
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace
admin@master01:~$ kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.1/cert-manager.crds.yaml
customresourcedefinition.apiextensions.k8s.io/certificaterequests.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/certificates.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/challenges.acme.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/clusterissuers.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/issuers.cert-manager.io configured
customresourcedefinition.apiextensions.k8s.io/orders.acme.cert-manager.io configured
admin@master01:~$
admin@master01:~$ helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace  
NAME: cert-manager
LAST DEPLOYED: Wed Aug 21 14:56:52 2024
NAMESPACE: cert-manager
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
cert-manager v1.15.3 has been deployed successfully!

In order to begin issuing certificates, you will need to set up a ClusterIssuer
or Issuer resource (for example, by creating a 'letsencrypt-staging' issuer).

More information on the different types of issuers and how to configure them
can be found in our documentation:

https://cert-manager.io/docs/configuration/

For information on how to configure cert-manager to automatically provision
Certificates for Ingress resources, take a look at the `ingress-shim`
documentation:

https://cert-manager.io/docs/usage/ingress/
admin@master01:~$

Install Rancher

Melakukan instalasi rancher, sesuaikan untuk nama hostname nya, pastikan resolve dns atau setting /etc/host di laptop, kalau belum ada domain, bisa menggunakan alamat ip diikuti .sslip.io dns server ini akan meresolve ke ip kembali

helm install rancher rancher-latest/rancher --namespace cattle-system --set hostname=10.20.30.40.sslip.io --set replicas=3 --set bootstrapPassword=PassWordRancher --create-namespace 

Pengecekan deployment

masadmin@master01:~$ kubectl -n cattle-system rollout status deploy/rancher
deployment "rancher" successfully rolled out
masadmin@master01:~$
admin@master01:~$ kubectl -n cattle-system rollout status deploy/rancher
deployment "rancher" successfully rolled out
masadmin@master01:~$
masadmin@master01:~$ kubectl get pods -n cattle-system
NAME                      READY   STATUS    RESTARTS   AGE
helm-operation-h99ws      2/2     Running   0          83s
helm-operation-skft9      2/2     Running   0          21s
rancher-57d8d66fb-2wbt4   1/1     Running   0          4m9s
rancher-57d8d66fb-92rd7   1/1     Running   0          4m9s
rancher-57d8d66fb-l2tsj   1/1     Running   0          4m9s
admin@master01:~$

Check Password Rancher

echo https://10.20.30.40.sslip.io/dashboard/?setup=$(kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}')

Leave a Reply

Your email address will not be published. Required fields are marked *