Rancher v2.2.0-Alpha3 Multi-Tenant Prometheus Support 정보

Rancher2.2의 Alpha 버전에서 Multi-Tenant Pormetheus 기능이 지원되었다는 것으로 시도했습니다.
놀라울 정도로 쉽게 Prometheus + Grafana 환경을 구축할 수 있습니다.

다음 구성으로 확인해 보았습니다.



Rancher Server Version:2.2.0-Alpha3

1. Rancher Server 구축



1.Instance 준비




품목
입력 개요


이름
rancher-server

지역
asia-northeast1(도쿄)


아시아-northeast1-b

기계 유형
vCPUx1

부팅 디스크
우분투 16.04 LTS 디스크 크기 80GB

방화벽
HTTP 트래픽 허용, HTTPS 트래픽 허용을 모두 확인합니다.


2.Docker 설치



명령
$ curl https://releases.rancher.com/install-docker/18.09.sh | sh
・
・(省略)
・
+ sudo -E sh -c docker version
Client:
 Version:           18.09.3
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        774a1f4
 Built:             Thu Feb 28 06:40:58 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.3
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       774a1f4
  Built:            Thu Feb 28 05:59:55 2019
  OS/Arch:          linux/amd64
  Experimental:     false

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker iyutaka2018

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker iyutaka2018

Remember that you will have to log out and back in for this to take effect!

WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

3. Rancher2.2.0-Alpha3 Server 설치



명령
$ sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:v2.2.0-alpha3
Unable to find image 'rancher/rancher:v2.2.0-alpha3' locally
v2.2.0-alpha3: Pulling from rancher/rancher
32802c0cfa4d: Pull complete 
da1315cffa03: Pull complete 
fa83472a3562: Pull complete 
f85999a86bef: Pull complete 
a4daac5bee2d: Pull complete 
bf26f1964577: Pull complete 
a00bebfc6f0e: Pull complete 
3afff0aaa1d8: Pull complete 
8f3d31deda5a: Pull complete 
aa24579912ce: Pull complete 
6d77f6748e72: Pull complete 
d47b70b03591: Pull complete 
Digest: sha256:db7fe1ba357cfe5238634f2fb21085177b3ad897cec1aacacca1b3e2b22152a2
Status: Downloaded newer image for rancher/rancher:v2.2.0-alpha3
3a8894aa888fdb14d08c676b51d3a4011f5ee794f61eb90a6fe013e690e73057

4. 브라우저를 시작하여 RancherUI에 액세스



5. 첫 로그인



a.admin 사용자의 비밀번호 생성



임의의 비밀번호 입력


b.Rancher Server URL 등록



Save URL 버튼을 누르십시오.


c. 로그인 완료





2.Single Kubernetes Cluster 구축



1.Instance 준비




품목
입력 개요


이름
rancher-k8s-cluster

지역
asia-northeast1(도쿄)


아시아-northeast1-b

기계 유형
vCPUx1

부팅 디스크
우분투 16.04 LTS 디스크 크기 80GB

방화벽
HTTP 트래픽 허용, HTTPS 트래픽 허용을 모두 확인합니다.


2.rancher-k8s-cluster에 Docker 설치



명령
$ curl https://releases.rancher.com/install-docker/17.03.2.sh | sh
・
・(省略)
・
+ sudo -E sh -c docker version
Client:
 Version:      17.03.2-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   f5ec1e2
 Built:        Tue Jun 27 03:35:14 2017
 OS/Arch:      linux/amd64
Server:
 Version:      17.03.2-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   f5ec1e2
 Built:        Tue Jun 27 03:35:14 2017
 OS/Arch:      linux/amd64
 Experimental: false
If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:
  sudo usermod -aG docker iyutaka2018
Remember that you will have to log out and back in for this to take effect!
WARNING: Adding a user to the "docker" group will grant the ability to run
         containers which can be used to obtain root privileges on the
         docker host.
         Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface
         for more information.

3. Kubernetes 클러스터 구축



1. "Add Cluster"버튼을 누르십시오





2. "Custom"을 선택하고 "Cluster Name"에 임의의 이름을 입력하고 "Next"버튼을 누르십시오.





3. 「Node Role」의 「etcd」와 「Control Plane」에 체크, 「Copy to Clipboard」버튼을 눌러





4. 복사한 명령을 rancher-k8s-cluster 콘솔에서 실행



명령
$ sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run rancher/rancher-agent:v2.2.0-alpha3 --server https://35.243.83.224 --token xx9ttl6ckrkzppk6msvx7jzslcc75m8m7pwbws7fjvbdls2g9l6nrn --ca-checksum 487497cfc43e87a717ca8c775c2b0e19677bf0a73b5091ee1572b8546defec75 --etcd --controlplane --worker

5. "Done"버튼을 누르십시오.





6. "rancher-k8s-cluster"를 선택





7. 상단 메뉴 'Tools'-'Monitoring'을 선택





8.Prometheus 아이콘을 선택하고 "Save"버튼을 누르십시오



이 작업만으로 자동으로 Prometheus + Grafana 환경이 구축됩니다.



9. 화면이 전환되어 Prometheus + Grafana가 활성화되었는지 확인





10. 아코디언 메뉴 확장



각 메트릭에서 그래프를 볼 수 있습니다. 기본적으로 오른쪽 상단 풀다운 메뉴가 "1hour"이므로 "5minute"로 변경하면 그래프가 나옵니다.



커서를 그래프에 맞추면 세부 정보가 표시됩니다.



11.Grafana 아이콘을 클릭하면 Grafana 대시보드에서 확인 가능





Nodes


Cluster


12. "Launch kubectl"버튼을 누르십시오.





13. "kubectl get pods --all-namespaces"를 실행하여 상태 확인



명령
# Run kubectl commands inside here
# e.g. kubectl get all
> kubectl get pods --all-namespaces
NAMESPACE           NAME                                                      READY     STATUS      RESTARTS   AGE
cattle-prometheus   exporter-kube-state-cluster-monitoring-779b96cf75-gg272   1/1       Running     0          20m
cattle-prometheus   exporter-node-cluster-monitoring-ljhch                    1/1       Running     0          20m
cattle-prometheus   grafana-cluster-monitoring-5b4bc74756-hx7mx               3/3       Running     0          20m
cattle-prometheus   prometheus-cluster-monitoring-0                           4/4       Running     1          20m
cattle-prometheus   prometheus-cluster-monitoring-nginx-5ff785dd4d-d6l8l      1/1       Running     3          20m
cattle-prometheus   prometheus-operator-system-monitor-77df6db6df-gdmmz       1/1       Running     0          20m
cattle-system       cattle-cluster-agent-77498f79c-5w78s                      1/1       Running     0          30m
cattle-system       cattle-node-agent-s8gnz                                   1/1       Running     0          30m
ingress-nginx       default-http-backend-5bdd9fdd69-2ntmw                     1/1       Running     0          30m
ingress-nginx       nginx-ingress-controller-xdwnk                            1/1       Running     0          30m
kube-system         canal-wzw4r                                               3/3       Running     0          30m
kube-system         kube-dns-autoscaler-689f6f9756-zqn6f                      1/1       Running     0          30m
kube-system         kube-dns-ddddcfcc8-xbpwn                                  3/3       Running     0          30m
kube-system         metrics-server-5444cf6dfc-g7xvp                           1/1       Running     0          30m
kube-system         rke-ingress-controller-deploy-job-bshtx                   0/1       Completed   0          30m
kube-system         rke-kubedns-addon-deploy-job-k9vxg                        0/1       Completed   0          30m
kube-system         rke-metrics-addon-deploy-job-hmr7k                        0/1       Completed   0          30m
kube-system         rke-network-plugin-deploy-job-tjqhn                       0/1       Completed   0          31m



4.Documents


  • How to Get Started with Rancher’s New Multi-Tenant Prometheus Support and Alpha Release Process
  • 좋은 웹페이지 즐겨찾기