Rancher安裝

1. What's Rancher?

Rancher是一套容器管理平臺,它能夠幫助組織在生產環境中輕鬆快捷的部署和管理容器。 Rancher能夠輕鬆地管理各類環境的Kubernetes,知足IT需求併爲DevOps團隊提供支持。node

Kubernetes不只已經成爲的容器編排標準,它也正在迅速成爲各種雲和虛擬化廠商提供的標準基礎架構。Rancher用戶能夠選擇使用Rancher Kubernetes Engine(RKE)建立Kubernetes集羣,也能夠使用GKE,AKS和EKS等雲Kubernetes服務。 Rancher用戶還能夠導入和管理現有的Kubernetes集羣。docker

Rancher支持各種集中式身份驗證系統來管理Kubernetes集羣。例如,大型企業的員工能夠使用其公司Active Directory憑證訪問GKE中的Kubernetes集羣。IT管​​理員能夠在用戶,組,項目,集羣和雲中設置訪問控制和安全策略。 IT管​​理員能夠在單個頁面對全部Kubernetes集羣的健康情況和容量進行監控。shell

Rancher爲DevOps工程師提供了一個直觀的用戶界面來管理他們的服務容器,用戶不須要深刻了解Kubernetes概念就能夠開始使用Rancher。 Rancher包含應用商店,支持一鍵式部署Helm和Compose模板。Rancher經過各類雲、本地生態系統產品認證,其中包括安全工具,監控系統,容器倉庫以及存儲和網絡驅動程序。下圖說明了Rancher在IT和DevOps組織中扮演的角色。每一個團隊都會在他們選擇的公共雲或私有云上部署應用程序。json

Rancher Platform

2. What's New?

早期的Rancher1.X版本是基於Docker以Cattle爲調度引擎的容器管理平臺。在Rancher1.X成功和經驗的基礎上,基於Kubernetes基礎上從新設計Rancher2.0版本。 Rancher2.0保留了1.6版的友好功能,如UI和應用商店。可是,2.0包含許多新功能,例如:vim

  • 內置CI/CD;
  • 告警和日誌收集;
  • 多集羣管理;
  • Rancher Kubernetes Engine (RKE);
  • 與雲Kubernetes服務(如GKE,EKS和AKS)集成;

3. 安裝Rancher

要想在主機上安裝Rancher,須要先登陸到主機上,接着進行如下步驟:api

  1. 經過shell工具(例如PuTTy或遠程終端鏈接)登陸到主機瀏覽器

  2. 在shell中執行如下命令:安全

    [root@localhost ~]# mkdir -p /etc/docker
    [root@localhost ~]# vim /etc/docker/daemon.json
    [root@localhost ~]# systemctl daemon-reload
    [root@localhost ~]# systemctl restart docker
    [root@localhost ~]# mkdir /rancher
    [root@localhost ~]# docker run -d --restart=unless-stopped -v /rancher/:/var/lib/rancher/ -p 80:80 -p 443:443 rancher/rancher:stable
    Unable to find image 'rancher/rancher:stable' locally stable: Pulling from rancher/rancher 7ddbc47eeb70: Pull complete c1bbdc448b72: Pull complete 8c3b70e39044: Pull complete 45d437916d57: Pull complete 28a9e619eb92: Pull complete 3922b811dfe2: Pull complete 81d9d43baeba: Pull complete ea183fe1d558: Pull complete 59cb3488b9cd: Pull complete 470bfb078fde: Pull complete 9d3364413c7e: Pull complete dcceab1151c5: Pull complete 22541110ae37: Pull complete 594323731b75: Pull complete Digest: sha256:e1da0ac036379f3bb58b3a8a94ba7f794aca9ec34bb42ca24d1e935c4a744f1e Status: Downloaded newer image for rancher/rancher:stable 5c8e861f6a7049eb86dc01fab3a4fdf99394538660c40557ad5ff7e2f6f55e8e [root@localhost ~]# docker ps -l
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5c8e861f6a70 rancher/rancher:stable   "entrypoint.sh"     23 seconds ago      Up 21 seconds       0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp suspicious_davinci [root@localhost ~]#

4. 登陸Rancher

登陸並開始使用Rancher。登陸後,您將進行一些一次性配置。bash

    1. 打開瀏覽器,輸入https://<server_ip>,server_ip替換爲運行Rancher容器主機的ip;網絡

    2. 由於是自動使用的自簽名證書,在第一次登陸會提示安全授信問題,信任便可;

image-20180703152812587

設置管理員密碼

第一次登陸會要求設置管理員密碼,默認管理員帳號爲: admin

若是沒有設置密碼而要求輸入當前密碼,能夠輸入密碼: admin

image-20180703152943118

設置Rancher Server URL

Rancher Server URL是agent節點註冊到Rancher Serverd的地址,須要保證這個地址可以被agent主機訪問,不要設置爲127.0.0.1或者localhost

5 添加k8s集羣

 

[root@k8s-master ~]# kubectl apply -f https://192.168.180.137/v3/import/bgf67bfvhnhx6btnz4l4ktnqlzn4dq5wm942vsq7rxmv6w2zk5ht2c.yaml
Unable to connect to the server: x509: certificate signed by unknown authority [root@k8s-master ~]# ll
總用量 279904
-rw-------. 1 root root      1731 12月 18 00:07 anaconda-ks.cfg drwxr-xr-x  3 root root        59 1月   7 17:20 efk -rw-r--r--. 1 root root      1779 12月 18 00:11 initial-setup-ks.cfg -rwxr-xr-x  1 root root  39305216 1月   5 19:40 kubeadm -rw-r--r--  1 root root      1028 12月 19 22:26 kubeadm-config.yaml -rw-r--r--  1 root root      4668 12月 19 22:20 kubeadm-init.log -rw-r--r--  1 root root     14416 12月 19 22:36 kube-flannel.yml -rw-r--r--. 1 root root       484 12月 18 09:40 kubernetes.conf -rw-r--r--  1 root root       199 1月   7 00:57 load-images.sh drwxr-xr-x  2 root root       315 8月   2 17:16 prometheus -rw-r--r--  1 root root 247267436 1月   7 00:57 prometheus.tar.gz [root@k8s-master ~]# curl --insecure -sfL https://192.168.180.137/v3/import/bgf67bfvhnhx6btnz4l4ktnqlzn4dq5wm942vsq7rxmv6w2zk5ht2c.yaml | kubectl apply -f -
clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver created clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master created namespace/cattle-system created serviceaccount/cattle created clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding created secret/cattle-credentials-e3c7b4d created clusterrole.rbac.authorization.k8s.io/cattle-admin created deployment.apps/cattle-cluster-agent created daemonset.apps/cattle-node-agent created

 

 

 

 

 

相關文章
相關標籤/搜索