#kubernetes #kubernetes-service #kubernetes-dashboard
Вопрос:
У нас есть настройка кластера с несколькими узлами, теперь попробуйте установить панель мониторинга.
Я запустил команду kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml
, и она развернула все ресурсы.
Я проверяю, создана ли служба.
# kubectl get services -n kubernetes-dashboard NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-metrics-scraper ClusterIP 10.103.75.109 lt;nonegt; 8000/TCP 4m53s kubernetes-dashboard ClusterIP 10.106.194.108 lt;nonegt; 443/TCP 4m53s
Затем попробуйте получить доступ к URL-адресу службы.
# curl https://10.106.194.108 -k lt;!-- Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --gt;lt;!DOCTYPE htmlgt;lt;html lang="en"gt;lt;headgt; lt;meta charset="utf-8"gt; lt;titlegt;Kubernetes Dashboardlt;/titlegt; lt;link rel="icon" type="image/png" href="assets/images/kubernetes-logo.png"gt; lt;meta name="viewport" content="width=device-width"gt; lt;stylegt;body,html{height:100%;margin:0;}lt;/stylegt;lt;link rel="stylesheet" href="styles.aa0538c9a91ebbb04705.css" media="print" onload="this.media='all'"gt;lt;noscriptgt;lt;link rel="stylesheet" href="styles.aa0538c9a91ebbb04705.css"gt;lt;/noscriptgt;lt;/headgt; lt;bodygt; lt;kd-rootgt;lt;/kd-rootgt; lt;script src="runtime.1a20bc8321eb559541a1.js" defergt;lt;/scriptgt;lt;script src="polyfills.2565916e4afd13edaa84.js" defergt;lt;/sc creationTimestamp: "2021-11-09T21:20:14Z" riptgt;lt;script src="scripts.f76573725d49abb057d3.js" defergt;lt;/scriptgt;lt;script src="en.main.7f7baee1f12d075d7cb9.js" defergt;lt;/scriptgt; lt;/bodygt;lt;/htmlgt;
Затем я выполняю действия по преобразованию ClusterIP
в NodePort
,
Обслуживание перед конвертацией.
# kubectl -n kubernetes-dashboard describe service kubernetes-dashboard Name: kubernetes-dashboard Namespace: kubernetes-dashboard Labels: k8s-app=kubernetes-dashboard Annotations: lt;nonegt; Selector: k8s-app=kubernetes-dashboard Type: ClusterIP IP Family Policy: SingleStack IP Families: IPv4 IP: 10.106.194.108 IPs: 10.106.194.108 Port: lt;unsetgt; 443/TCP TargetPort: 8443/TCP Endpoints: 192.168.211.130:8443 Session Affinity: None Events: lt;nonegt;
Service after edit using kubectl -n kubernetes-dashboard edit service kubernetes-dashboard
command.
# kubectl -n kubernetes-dashboard describe service kubernetes-dashboard Name: kubernetes-dashboard Namespace: kubernetes-dashboard Labels: k8s-app=kubernetes-dashboard Annotations: lt;nonegt; Selector: k8s-app=kubernetes-dashboard Type: NodePort IP Family Policy: SingleStack IP Families: IPv4 IP: 10.106.194.108 IPs: 10.106.194.108 Port: lt;unsetgt; 443/TCP TargetPort: 8443/TCP NodePort: lt;unsetgt; 32358/TCP Endpoints: 192.168.211.130:8443 Session Affinity: None External Traffic Policy: Cluster Events: lt;nonegt;
тогда curl https://10.106.194.108:32358 -k
никогда не возвращайте данные :(.
Я проверяю IP-адрес модуля, и он работает.
# curl https://192.168.211.130:8443 -k lt;!-- Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --gt;lt;!DOCTYPE htmlgt;lt;html lang="en"gt;lt;headgt; lt;meta charset="utf-8"gt; lt;titlegt;Kubernetes Dashboardlt;/titlegt; lt;link rel="icon" type="image/png" href="assets/images/kubernetes-logo.png"gt; lt;meta name="viewport" content="width=device-width"gt; lt;stylegt;body,html{height:100%;margin:0;}lt;/stylegt;lt;link rel="stylesheet" href="styles.aa0538c9a91ebbb04705.css" media="print" onload="this.media='all'"gt;lt;noscriptgt;lt;link rel="stylesheet" href="styles.aa0538c9a91ebbb04705.css"gt;lt;/noscriptgt;lt;/headgt; lt;bodygt; lt;kd-rootgt;lt;/kd-rootgt; lt;script src="runtime.1a20bc8321eb559541a1.js" defergt;lt;/scriptgt;lt;script src="polyfills.2565916e4afd13edaa84.js" defergt;lt;/scriptgt;lt;script src="scripts.f76573725d49abb057d3.js" defergt;lt;/scriptgt;lt;script src="en.main.7f7baee1f12d075d7cb9.js" defergt;lt;/scriptgt; lt;/bodygt;lt;/htmlgt;
Как проверить, почему он не работает после перехода на NodePort
?
Комментарии:
1. запустите
kubectl get node -o wide
это, чтобы получить IP-адрес узла. Используйте этот IP — адрес с портом службы NodePort для свертывания….