安裝KubeOperator并導入現有叢集進行管理
介紹
KubeOperator 是一個開源的輕量級 Kubernetes 發行版,專注于幫助企業規劃、部署和營運生産級别的 Kubernetes 叢集。
KubeOperator 提供可視化的 Web UI,支援離線環境,支援實體機、VMware、OpenStack 和 FusionCompute 等 IaaS 平台,支援 x86 和 ARM64 架構,支援 GPU,内置應用商店,已認證 CNCF 的 Kubernetes 軟體一緻性認證。
KubeOperator 使用 Terraform 在 IaaS 平台上自動建立主機(使用者也可以自行準備主機,比如實體機或者虛機),通過 Ansible 完成自動化部署和變更操作,支援 Kubernetes 叢集 從 Day 0 規劃,到 Day 1 部署,到 Day 2 營運的全生命周期管理。
安裝
root@hello:~# curl -sSL https://github.com/KubeOperator/KubeOperator/releases/latest/download/quick_start.sh | sh
...略...
======================= KubeOperator 安裝完成 =======================
請開放或安全組的80,8081-8083端口,通過以下方式通路:
URL: http://$LOCAL_IP:80
使用者名: admin
初始密碼: kubeoperator@admin123
root@hello:~#
root@hello:~# koctl status
Name Command State Ports
-----------------------------------------------------------------------------------------------------------------------------------------------
kubeoperator_kobe sh /root/entrypoint.sh Up (healthy) 8080/tcp
kubeoperator_kotf kotf-server Up (healthy) 8080/tcp
kubeoperator_kubepi kubepi-server Up (healthy) 80/tcp
kubeoperator_mysql /entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
kubeoperator_nexus sh -c ${SONATYPE_DIR}/star ... Up (healthy) 0.0.0.0:8081->8081/tcp,:::8081->8081/tcp,
0.0.0.0:8082->8082/tcp,:::8082->8082/tcp,
0.0.0.0:8083->8083/tcp,:::8083->8083/tcp
kubeoperator_nginx /docker-entrypoint.sh /bin ... Up (healthy) 0.0.0.0:80->80/tcp,:::80->80/tcp
kubeoperator_server ko-server Up (healthy) 8080/tcp
kubeoperator_ui /docker-entrypoint.sh ngin ... Up (healthy) 80/tcp
kubeoperator_webkubectl sh /opt/webkubectl/start-w ... Up (healthy)
root@hello:~#
登陸
位址: http://<ko伺服器_ip>:80
使用者名: admin
密碼: kubeoperator@admin123
導入叢集
# 擷取 Api Server
[root@k8s-master01 ~]# cat ~/.kube/config | grep server: | awk '{print $2}'
https://192.168.1.69:8443
# 擷取 Router
# 若使用kubeadm安裝可以使用如下指令進行檢視 ,若二進制安裝使用節點IP即可
[root@k8s-master01 ~]# kubectl -n kube-system get pod -o wide | grep kube-proxy
[root@k8s-master01 ~]#
# 擷取 Token
[root@k8s-master01 ~]# vim 123.yaml
[root@k8s-master01 ~]# cat 123.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: kubeoperator-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kubeoperator-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kubeoperator-user
namespace: kube-system
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# kubectl apply -f 123.yaml
serviceaccount/kubeoperator-user created
clusterrolebinding.rbac.authorization.k8s.io/kubeoperator-user created
[root@k8s-master01 ~]#
[root@k8s-master01 ~]#
# 1.23 以及以下可以使用如下指令檢視
[root@k8s-master01 ~]# kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep kubeoperator-user | awk '{print $1}') | grep token: | awk '{print $2}'
[root@k8s-master01 ~]#
[root@k8s-master01 ~]#
# 1.24 版本使用如下指令建立token
[root@k8s-master01 ~]# kubectl -n kube-system create token kubeoperator-user
eyJhbGciOiJSUzI1NiIsImtpZCI6Ik9fdmIzY3ZjU2w0V3ZuUXl2bExBN2tZYlh3bFV2MTliZElSd0hvMnN6SXMifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNjU4ODk4MTE5LCJpYXQiOjE2NTg4OTQ1MTksImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsInNlcnZpY2VhY2NvdW50Ijp7Im5hbWUiOiJrdWJlb3BlcmF0b3ItdXNlciIsInVpZCI6ImZhOGJmZjJjLWIyYjYtNDAxMS1iODAzLTY4MDVmZDYwZjMxOSJ9fSwibmJmIjoxNjU4ODk0NTE5LCJzdWIiOiJzeXN0ZW06c2VydmljZWFjY291bnQ6a3ViZS1zeXN0ZW06a3ViZW9wZXJhdG9yLXVzZXIifQ.HvLQlMW_aJ2TDlyE-aM9UiDKl3QHAod9oUQZaHBI97-nLc3aoUdKsGrhICD42ud_Qcn_vFhUvJkPvBi_5esqKCB9LPF-cUhyyj0TxRIH_rTfUdzmDeYUVn3rfg0jlGkXRhzpJMLIRpsK_RB0StbDR4WxfhdnpRkFz-7YgtsRUfRZXG4AF6HNzt1ZWEA3ZVv779TqJemBUTmwJGB9OdyYkKTnGNy4tDGfryZsfW7zN-FhdVugd_7-_lNlFrLZWwrN3fUYPSZLGqulvy7BBpIBO16pBtIA0Qi0bkNdkSpu5a2RNjpMtXKVRYy7M--mQ4EaEod4aCZDuDhMz2S-75VwDA
[root@k8s-master01 ~]#
關于
https://www.oiox.cn/
GitHub、知乎、簡書、華為雲、阿裡雲、騰訊雲、哔哩哔哩、今日頭條、新浪微網誌、個人部落格