본문 바로가기
Programming/Kubernetes

Rancher on Kubernetes (쿠버네티스 클러스터에 Rancher 설치)

by guru_k 2021. 10. 20.
728x90
반응형

Rancher

Rancher는 다양한 인프라에 구성된 Cluster들을 손쉽게 관리해주는 툴이다. Rancher를 이용해서 사용자는 Kuberntes 를 손쉽게 배포하고 관리할 수 있다.

그럼 Rancher를 설치하고 대시보드까지 접속 해보자.

Install Rancher

Add helm repo

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

Create Rancher Namespace

$ kubectl create namespace cattle-system

Install cert-manager

# CustomResourceDefinition 설치
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.4/cert-manager.crds.yaml
customresourcedefinition.apiextensions.k8s.io/certificaterequests.cert-manager.io created
customresourcedefinition.apiextensions.k8s.io/certificates.cert-manager.io created
customresourcedefinition.apiextensions.k8s.io/challenges.acme.cert-manager.io created
customresourcedefinition.apiextensions.k8s.io/clusterissuers.cert-manager.io created
customresourcedefinition.apiextensions.k8s.io/issuers.cert-manager.io created
customresourcedefinition.apiextensions.k8s.io/orders.acme.cert-manager.io created

# cert-manager namespace 추가
$ kubectl create namespace cert-manager
namespace/cert-manager created

# Add jetstack helm repo
$ helm repo add jetstack https://charts.jetstack.io
"jetstack" has been added to your repositories

# 업데이트 헬름 저장소 로컬 캐시
$ 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-latest" chart repository
Update Complete. ⎈Happy Helming!⎈

# cert-manager helm chart 설치
$ helm install \
  cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --version v1.0.4
  
NAME: cert-manager
LAST DEPLOYED: Wed Oct 20 20:38:30 2021
NAMESPACE: cert-manager
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
cert-manager 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/

Verify cert-manager

# cert-manager 설치 확인
$ kubectl get pods --namespace cert-manager
NAME                                       READY   STATUS    RESTARTS   AGE
cert-manager-75dbbd5d6-kxf5j               1/1     Running   0          49m
cert-manager-cainjector-85c559fd6c-zpc2q   1/1     Running   0          49m
cert-manager-webhook-6c77dfbdb8-jfn72      1/1     Running   0          49m

Install Rancher

$ helm install rancher rancher-latest/rancher \
  --namespace cattle-system \
  --set hostname=rancher.my.org
  
NAME: rancher
LAST DEPLOYED: Wed Oct 20 20:41:25 2021
NAMESPACE: cattle-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Rancher Server has been installed.

NOTE: Rancher may take several minutes to fully initialize. Please standby while Certificates are being issued, Containers are started and the Ingress rule comes up.

Check out our docs at https://rancher.com/docs/

If you provided your own bootstrap password during installation, browse to https://localhost to get started.

If this is the first time you installed Rancher, get started by running this command and clicking the URL it generates:

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

To get just the bootstrap password on its own, run:

```
kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{ "\n" }}'
```


Happy Containering!

 

 

$ kubectl -n cattle-system rollout status deploy/rancher
Waiting for deployment "rancher" rollout to finish: 0 of 3 updated replicas are available...
Waiting for deployment "rancher" rollout to finish: 1 of 3 updated replicas are available...
Waiting for deployment "rancher" rollout to finis

Host 설정

# /etc/hosts

127.0.0.1 rancher.my.org

 

대시보드 접속

Rancher Dashboard

 

728x90
반응형

댓글