├── .gitattributes ├── .gitignore ├── README.md ├── add_etcd.sh ├── add_master.sh ├── add_node.sh ├── fabfile.py ├── images ├── dashboard.jpeg ├── finish-install.jpeg ├── getpods.jpeg ├── grafana_container.jpeg ├── grafana_node.jpeg ├── install_install.jpeg ├── install_k8scluster.jpeg ├── install_readme.jpeg ├── install_readme.pdf ├── install_resource.jpeg ├── instsall_example1.jpeg ├── instsall_example2.jpeg ├── instsall_example3.jpeg ├── instsall_example4.jpeg ├── instsall_example5.jpeg ├── instsall_example6.jpeg ├── instsall_example7.jpeg ├── prometheus.jpeg └── web-test.jpeg ├── install.sh ├── ls-files.txt ├── source ├── bind │ ├── etc │ │ ├── named.conf │ │ └── named.rfc1912.zones │ └── var │ │ └── named │ │ └── zones │ │ └── t.test.com.zone ├── calico │ └── calico.yaml.tpl ├── dashboard │ ├── dashboard-admin.yaml │ └── recommended.yaml.tpl ├── dns │ └── coredns.yaml.tpl ├── docker │ ├── create_ssl.sh.tpl │ ├── etc │ │ └── docker │ │ │ ├── certs.d │ │ │ ├── .gitkeep │ │ │ └── HOST:PORT │ │ │ │ └── ca.crt │ │ │ ├── daemon.json │ │ │ └── key.json │ ├── start_registry.sh.tpl │ └── usr │ │ └── lib │ │ └── systemd │ │ └── system │ │ └── docker.service ├── esn_base │ ├── Dockerfile │ ├── docker-entrypoint.sh │ └── ssh │ │ ├── esn │ │ ├── authorized_keys │ │ ├── id_rsa │ │ └── id_rsa.pub │ │ └── root │ │ ├── authorized_keys │ │ ├── id_rsa │ │ └── id_rsa.pub ├── etcd │ ├── ca-config.json │ ├── ca-csr.json │ ├── create_ssl.sh │ ├── etc │ │ └── etcd │ │ │ └── ssl │ │ │ └── .gitkeep │ ├── etcd-csr.json.tpl │ ├── etcd.service.tpl │ └── usr │ │ └── lib │ │ └── systemd │ │ └── system │ │ └── etcd.service ├── master │ ├── admin-csr.json.tpl │ ├── apiserver-csr.json.tpl │ ├── apiserver.tpl │ ├── ca-config.json │ ├── ca-config.json.tpl │ ├── ca-csr.json │ ├── config.tpl │ ├── controller-manager-csr.json.tpl │ ├── create_ssl.sh │ ├── etc │ │ └── kubernetes │ │ │ ├── controller-manager │ │ │ ├── pki │ │ │ └── .gitkeep │ │ │ └── scheduler │ ├── metrics-server-csr.json │ ├── scheduler-csr.json.tpl │ └── usr │ │ └── lib │ │ └── systemd │ │ └── system │ │ ├── kube-apiserver.service │ │ ├── kube-controller-manager.service │ │ └── kube-scheduler.service ├── metrics-server │ ├── auth-delegator.yaml │ ├── auth-reader.yaml │ ├── metrics-apiservice.yaml │ ├── metrics-server-deployment.yaml.tpl │ ├── metrics-server-service.yaml │ └── resource-reader.yaml ├── node │ ├── ca-config.json │ ├── config.tpl │ ├── etc │ │ └── kubernetes │ │ │ ├── kube-proxy.yaml │ │ │ ├── manifests │ │ │ └── .gitkeep │ │ │ ├── pki │ │ │ └── .gitkeep │ │ │ └── proxy │ ├── kube-proxy-csr.json │ ├── kubelet-csr.json.tpl │ ├── kubelet.tpl │ ├── kubelet.yaml.tpl │ └── usr │ │ └── lib │ │ └── systemd │ │ └── system │ │ ├── kube-proxy.service │ │ └── kubelet.service ├── prometheus │ ├── alertmanager-configmap.yaml │ ├── alertmanager-deployment.yaml.tpl │ ├── alertmanager-pvc.yaml │ ├── alertmanager-service.yaml │ ├── grafana.yaml.tpl │ ├── grafana │ │ ├── grafana.db │ │ └── plugins │ │ │ └── grafana-kubernetes-app-31da38a │ │ │ ├── .gitattributes │ │ │ ├── .gitignore │ │ │ ├── Gruntfile.js │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── dist │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ ├── components │ │ │ │ ├── clusters │ │ │ │ │ ├── clusterConfig.d.ts │ │ │ │ │ ├── clusterConfig.js │ │ │ │ │ ├── clusterConfig.js.map │ │ │ │ │ ├── clusterConfig.ts │ │ │ │ │ ├── clusterInfo.d.ts │ │ │ │ │ ├── clusterInfo.js │ │ │ │ │ ├── clusterInfo.js.map │ │ │ │ │ ├── clusterInfo.ts │ │ │ │ │ ├── clusterWorkloads.d.ts │ │ │ │ │ ├── clusterWorkloads.js │ │ │ │ │ ├── clusterWorkloads.js.map │ │ │ │ │ ├── clusterWorkloads.ts │ │ │ │ │ ├── clusters.d.ts │ │ │ │ │ ├── clusters.js │ │ │ │ │ ├── clusters.js.map │ │ │ │ │ ├── clusters.ts │ │ │ │ │ ├── nodeInfo.d.ts │ │ │ │ │ ├── nodeInfo.js │ │ │ │ │ ├── nodeInfo.js.map │ │ │ │ │ ├── nodeInfo.ts │ │ │ │ │ ├── partials │ │ │ │ │ │ ├── cluster_config.html │ │ │ │ │ │ ├── cluster_info.html │ │ │ │ │ │ ├── cluster_workloads.html │ │ │ │ │ │ ├── clusters.html │ │ │ │ │ │ ├── node_info.html │ │ │ │ │ │ └── pod_info.html │ │ │ │ │ ├── podInfo.d.ts │ │ │ │ │ ├── podInfo.js │ │ │ │ │ ├── podInfo.js.map │ │ │ │ │ └── podInfo.ts │ │ │ │ └── config │ │ │ │ │ ├── config.d.ts │ │ │ │ │ ├── config.html │ │ │ │ │ ├── config.js │ │ │ │ │ ├── config.js.map │ │ │ │ │ └── config.ts │ │ │ ├── css │ │ │ │ ├── dark.css │ │ │ │ └── light.css │ │ │ ├── dashboards │ │ │ │ ├── k8s-cluster.json │ │ │ │ ├── k8s-container.json │ │ │ │ ├── k8s-deployments.json │ │ │ │ └── k8s-node.json │ │ │ ├── datasource │ │ │ │ ├── datasource.d.ts │ │ │ │ ├── datasource.js │ │ │ │ ├── datasource.js.map │ │ │ │ ├── datasource.ts │ │ │ │ ├── module.d.ts │ │ │ │ ├── module.js │ │ │ │ ├── module.js.map │ │ │ │ ├── module.ts │ │ │ │ ├── partials │ │ │ │ │ ├── config.html │ │ │ │ │ └── query.editor.html │ │ │ │ ├── plugin.json │ │ │ │ ├── query_ctrl.d.ts │ │ │ │ ├── query_ctrl.js │ │ │ │ ├── query_ctrl.js.map │ │ │ │ └── query_ctrl.ts │ │ │ ├── img │ │ │ │ ├── app-menu-screenshot.png │ │ │ │ ├── cluster-dashboard-screenshot.png │ │ │ │ ├── container-dashboard-screenshot.png │ │ │ │ ├── logo.svg │ │ │ │ ├── namespace-details-screenshot.png │ │ │ │ ├── node-dashboard-screenshot.png │ │ │ │ ├── overview-screenshot.png │ │ │ │ └── pod-details-screenshot.png │ │ │ ├── module.d.ts │ │ │ ├── module.js │ │ │ ├── module.js.map │ │ │ ├── module.ts │ │ │ ├── panels │ │ │ │ ├── nodeData │ │ │ │ │ ├── module.d.ts │ │ │ │ │ ├── module.js │ │ │ │ │ ├── module.js.map │ │ │ │ │ ├── module.ts │ │ │ │ │ ├── nodeData.d.ts │ │ │ │ │ ├── nodeData.js │ │ │ │ │ ├── nodeData.js.map │ │ │ │ │ ├── nodeData.ts │ │ │ │ │ ├── nodeStats.d.ts │ │ │ │ │ ├── nodeStats.js │ │ │ │ │ ├── nodeStats.js.map │ │ │ │ │ ├── nodeStats.ts │ │ │ │ │ ├── partials │ │ │ │ │ │ └── node_info.html │ │ │ │ │ └── plugin.json │ │ │ │ └── podNav │ │ │ │ │ ├── module.d.ts │ │ │ │ │ ├── module.js │ │ │ │ │ ├── module.js.map │ │ │ │ │ ├── module.ts │ │ │ │ │ ├── partials │ │ │ │ │ └── pod_nav.html │ │ │ │ │ ├── plugin.json │ │ │ │ │ ├── podNav.d.ts │ │ │ │ │ ├── podNav.js │ │ │ │ │ ├── podNav.js.map │ │ │ │ │ └── podNav.ts │ │ │ └── plugin.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ ├── components │ │ │ │ ├── clusters │ │ │ │ │ ├── clusterConfig.ts │ │ │ │ │ ├── clusterInfo.ts │ │ │ │ │ ├── clusterWorkloads.ts │ │ │ │ │ ├── clusters.ts │ │ │ │ │ ├── nodeInfo.ts │ │ │ │ │ ├── partials │ │ │ │ │ │ ├── cluster_config.html │ │ │ │ │ │ ├── cluster_info.html │ │ │ │ │ │ ├── cluster_workloads.html │ │ │ │ │ │ ├── clusters.html │ │ │ │ │ │ ├── node_info.html │ │ │ │ │ │ └── pod_info.html │ │ │ │ │ └── podInfo.ts │ │ │ │ └── config │ │ │ │ │ ├── config.html │ │ │ │ │ └── config.ts │ │ │ ├── css │ │ │ │ ├── dark.css │ │ │ │ └── light.css │ │ │ ├── dashboards │ │ │ │ ├── k8s-cluster.json │ │ │ │ ├── k8s-container.json │ │ │ │ ├── k8s-deployments.json │ │ │ │ └── k8s-node.json │ │ │ ├── datasource │ │ │ │ ├── datasource.ts │ │ │ │ ├── img │ │ │ │ │ └── logo.svg │ │ │ │ ├── module.ts │ │ │ │ ├── partials │ │ │ │ │ ├── config.html │ │ │ │ │ └── query.editor.html │ │ │ │ ├── plugin.json │ │ │ │ └── query_ctrl.ts │ │ │ ├── img │ │ │ │ ├── app-menu-screenshot.png │ │ │ │ ├── cluster-dashboard-screenshot.png │ │ │ │ ├── container-dashboard-screenshot.png │ │ │ │ ├── logo.svg │ │ │ │ ├── namespace-details-screenshot.png │ │ │ │ ├── node-dashboard-screenshot.png │ │ │ │ ├── overview-screenshot.png │ │ │ │ └── pod-details-screenshot.png │ │ │ ├── module.ts │ │ │ ├── panels │ │ │ │ ├── nodeData │ │ │ │ │ ├── module.ts │ │ │ │ │ ├── nodeData.ts │ │ │ │ │ ├── nodeStats.ts │ │ │ │ │ ├── partials │ │ │ │ │ │ └── node_info.html │ │ │ │ │ └── plugin.json │ │ │ │ └── podNav │ │ │ │ │ ├── module.ts │ │ │ │ │ ├── partials │ │ │ │ │ └── pod_nav.html │ │ │ │ │ ├── plugin.json │ │ │ │ │ └── podNav.ts │ │ │ └── plugin.json │ │ │ ├── tsconfig.json │ │ │ ├── tslint.json │ │ │ └── yarn.lock │ ├── kube-state-metrics-deployment.yaml.tpl │ ├── kube-state-metrics-rbac.yaml │ ├── kube-state-metrics-service.yaml │ ├── node-exporter-ds.yaml.tpl │ ├── node-exporter-service.yaml │ ├── persistentvolume.yaml │ ├── prometheus-configmap.yaml │ ├── prometheus-rbac.yaml │ ├── prometheus-service.yaml │ └── prometheus-statefulset.yaml.tpl └── web_test │ ├── Dockerfile.tpl │ ├── create.sh.tpl │ ├── server │ ├── hello │ ├── start_cmd.sh │ └── stop_cmd.sh │ └── yaml │ ├── pod.yaml.tpl │ └── svc.yaml ├── sysbase ├── Makefile ├── README.md ├── backend │ ├── README.md │ ├── args │ │ ├── builder.go │ │ └── holder.go │ ├── binary.list │ ├── config │ │ └── config.go │ ├── etc │ │ ├── config-demo.yaml │ │ ├── config.js │ │ └── config.yaml │ ├── go.mod │ ├── go.sum │ ├── handler │ │ ├── installk8s.go │ │ ├── k8scluster.go │ │ ├── k8sclusterresource.go │ │ ├── pod.go │ │ ├── podresource.go │ │ ├── resource.go │ │ ├── response.go │ │ └── tenantpod.go │ ├── installk8s │ │ ├── base.go │ │ ├── common.go │ │ ├── containerd.go │ │ ├── etcd.go │ │ ├── finish.go │ │ ├── master.go │ │ ├── newetcd.go │ │ ├── newmaster.go │ │ ├── newnode.go │ │ ├── node.go │ │ └── service.go │ ├── main.go │ ├── model │ │ ├── k8scluster.go │ │ ├── k8sclusterresource.go │ │ ├── model.go │ │ ├── pod.go │ │ ├── podresource.go │ │ ├── resource.go │ │ └── tenantpod.go │ ├── router │ │ ├── middleware │ │ │ ├── auth │ │ │ │ └── auth.go │ │ │ └── cors │ │ │ │ └── cors.go │ │ └── router.go │ ├── server │ │ ├── unix.go │ │ └── windows.go │ ├── tool │ │ ├── execremote │ │ │ └── execremote.go │ │ ├── hello │ │ │ └── hello.go │ │ ├── updatesecret │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── main.go │ │ │ └── serviceaccount │ │ │ │ ├── jwt.go │ │ │ │ ├── legacy.go │ │ │ │ └── metrics.go │ │ └── waitoutput │ │ │ └── waitoutput.go │ └── version │ │ └── version.go └── frontend │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── package.json │ ├── public │ ├── favicon.ico │ └── index.html │ ├── src │ ├── App.vue │ ├── assets │ │ └── logo.png │ ├── components │ │ ├── AceEditor.vue │ │ ├── K8sCluster.vue │ │ ├── Pod.vue │ │ ├── Resource.vue │ │ └── Tenant.vue │ ├── element-variables.scss │ ├── main.js │ ├── plugins │ │ └── element.js │ ├── router │ │ └── index.js │ ├── store │ │ └── index.js │ ├── tools │ │ ├── request.js │ │ └── stream.js │ └── views │ │ ├── About.vue │ │ └── Home.vue │ ├── vue.config.js │ └── yarn.lock └── uninstall.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.tar filter=lfs diff=lfs merge=lfs -text 2 | *.gz filter=lfs diff=lfs merge=lfs -text 3 | source/master/usr/bin/kube-apiserver filter=lfs diff=lfs merge=lfs -text 4 | source/master/usr/bin/kube-controller-manager filter=lfs diff=lfs merge=lfs -text 5 | source/master/usr/bin/kube-scheduler filter=lfs diff=lfs merge=lfs -text 6 | source/node/usr/bin/kube-proxy filter=lfs diff=lfs merge=lfs -text 7 | source/node/usr/bin/kubelet filter=lfs diff=lfs merge=lfs -text 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | ls-files-v1.16.3.1.gz 3 | 4 | -------------------------------------------------------------------------------- /add_master.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ------------------------------------------------------------------------------- 3 | # Filename: add_node.sh 4 | # Revision: 2.0 5 | # Date: 2018/06/21 6 | # Author: bishenghua 7 | # Email: net.bsh@gmail.com 8 | # Description: Script to install the kubernets system 9 | # ------------------------------------------------------------------------------- 10 | # Copyright: 2018 (c) Bishenghua 11 | # License: GPL 12 | # 13 | # This program is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU General Public License 15 | # as published by the Free Software Foundation; either version 2 16 | # of the License, or (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty 20 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | # GNU General Public License for more details. 22 | # 23 | # you should have received a copy of the GNU General Public License 24 | # along with this program (or with Nagios); 25 | # 26 | # Credits go to Ethan Galstad for coding Nagios 27 | # If any changes are made to this script, please mail me a copy of the changes 28 | # ------------------------------------------------------------------------------- 29 | 30 | echo -e "\033[32m{`date`}[开始]关闭master服务服务.............................\033[0m" 31 | fab service_master:stop || exit 1 32 | echo -e "\033[32m{`date`}[结束]关闭master服务服务.............................\n\n\n\n\n\n\033[0m" 33 | 34 | echo -e "\033[32m{`date`}[开始]安装基础环境.............................\033[0m" 35 | fab newmaster_install_base || exit 1 36 | echo -e "\033[32m{`date`}[结束]安装基础环境.............................\n\n\n\n\n\n\033[0m" 37 | 38 | echo -e "\033[32m{`date`}[开始]安装master节点.............................\033[0m" 39 | fab newmaster_install_master || exit 1 40 | echo -e "\033[32m{`date`}[结束]安装master节点.............................\n\n\n\n\n\n\033[0m" 41 | 42 | echo -e "\033[32m{`date`}[开始]启动新master节点.............................\033[0m" 43 | fab service_master:start || exit 1 44 | fab newmaster_service_master_start || exit 1 45 | echo -e "\033[32m{`date`}[结束]启动新master节点.............................\n\n\n\n\n\n\033[0m" 46 | 47 | echo -e "\033[32m{`date`}[开始]修改lvs配置.............................\033[0m" 48 | fab newmaster_install_lvsvip_master || exit 1 49 | fab remote_install_lvs_new || exit 1 50 | echo -e "\033[32m{`date`}[结束]修改lvs配置.............................\n\n\n\n\n\n\033[0m" 51 | 52 | echo -e "\033[32m{`date`}[开始]重启node服务.............................\033[0m" 53 | fab newmaster_service_node_restart || exit 1 54 | echo -e "\033[32m{`date`}[结束]重启node服务.............................\n\n\n\n\n\n\033[0m" 55 | 56 | echo -e "\033[32m{`date`}[结束]所有节点添加完毕\033[0m\033[31m[祝您好运!]\033[0m\033[32m.............................\n\n\n\n\n\n\033[0m" 57 | -------------------------------------------------------------------------------- /add_node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ------------------------------------------------------------------------------- 3 | # Filename: add_node.sh 4 | # Revision: 2.0 5 | # Date: 2018/06/21 6 | # Author: bishenghua 7 | # Email: net.bsh@gmail.com 8 | # Description: Script to install the kubernets system 9 | # ------------------------------------------------------------------------------- 10 | # Copyright: 2018 (c) Bishenghua 11 | # License: GPL 12 | # 13 | # This program is free software; you can redistribute it and/or 14 | # modify it under the terms of the GNU General Public License 15 | # as published by the Free Software Foundation; either version 2 16 | # of the License, or (at your option) any later version. 17 | # 18 | # This program is distributed in the hope that it will be useful, 19 | # but WITHOUT ANY WARRANTY; without even the implied warranty 20 | # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | # GNU General Public License for more details. 22 | # 23 | # you should have received a copy of the GNU General Public License 24 | # along with this program (or with Nagios); 25 | # 26 | # Credits go to Ethan Galstad for coding Nagios 27 | # If any changes are made to this script, please mail me a copy of the changes 28 | # ------------------------------------------------------------------------------- 29 | 30 | echo -e "\033[32m{`date`}[开始]安装基础环境.............................\033[0m" 31 | fab newnode_install_base || exit 1 32 | echo -e "\033[32m{`date`}[结束]安装基础环境.............................\n\n\n\n\n\n\033[0m" 33 | 34 | echo -e "\033[32m{`date`}[开始]安装docker.............................\033[0m" 35 | fab newnode_install_docker || exit 1 36 | echo -e "\033[32m{`date`}[结束]安装docker.............................\n\n\n\n\n\n\033[0m" 37 | 38 | echo -e "\033[32m{`date`}[开始]安装docker证书.............................\033[0m" 39 | fab newnode_install_dockercrt || exit 1 40 | echo -e "\033[32m{`date`}[结束]安装docker证书.............................\n\n\n\n\n\n\033[0m" 41 | 42 | echo -e "\033[32m{`date`}[开始]安装node节点.............................\033[0m" 43 | fab newnode_install_node || exit 1 44 | echo -e "\033[32m{`date`}[结束]安装node节点.............................\n\n\n\n\n\n\033[0m" 45 | 46 | echo -e "\033[32m{`date`}[开始]启动新node节点.............................\033[0m" 47 | fab newnode_service_node_start || exit 1 48 | echo -e "\033[32m{`date`}[结束]启动新node节点.............................\n\n\n\n\n\n\033[0m" 49 | 50 | echo -e "\033[32m{`date`}[开始]修改kubelet配置加载cni.............................\033[0m" 51 | fab newnode_kubeletcni_node || exit 1 52 | echo -e "\033[32m{`date`}[结束]修改kubelet配置加载cni.............................\n\n\n\n\n\n\033[0m" 53 | 54 | echo -e "\033[32m{`date`}[结束]所有节点添加完毕\033[0m\033[31m[祝您好运!]\033[0m\033[32m.............................\n\n\n\n\n\n\033[0m" 55 | -------------------------------------------------------------------------------- /images/dashboard.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/dashboard.jpeg -------------------------------------------------------------------------------- /images/finish-install.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/finish-install.jpeg -------------------------------------------------------------------------------- /images/getpods.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/getpods.jpeg -------------------------------------------------------------------------------- /images/grafana_container.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/grafana_container.jpeg -------------------------------------------------------------------------------- /images/grafana_node.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/grafana_node.jpeg -------------------------------------------------------------------------------- /images/install_install.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/install_install.jpeg -------------------------------------------------------------------------------- /images/install_k8scluster.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/install_k8scluster.jpeg -------------------------------------------------------------------------------- /images/install_readme.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/install_readme.jpeg -------------------------------------------------------------------------------- /images/install_readme.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/install_readme.pdf -------------------------------------------------------------------------------- /images/install_resource.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/install_resource.jpeg -------------------------------------------------------------------------------- /images/instsall_example1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example1.jpeg -------------------------------------------------------------------------------- /images/instsall_example2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example2.jpeg -------------------------------------------------------------------------------- /images/instsall_example3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example3.jpeg -------------------------------------------------------------------------------- /images/instsall_example4.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example4.jpeg -------------------------------------------------------------------------------- /images/instsall_example5.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example5.jpeg -------------------------------------------------------------------------------- /images/instsall_example6.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example6.jpeg -------------------------------------------------------------------------------- /images/instsall_example7.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/instsall_example7.jpeg -------------------------------------------------------------------------------- /images/prometheus.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/prometheus.jpeg -------------------------------------------------------------------------------- /images/web-test.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/images/web-test.jpeg -------------------------------------------------------------------------------- /ls-files.txt: -------------------------------------------------------------------------------- 1 | source/images/HOST:PORT~busybox:latest.tar 2 | source/images/HOST:PORT~grafana~grafana:6.4.4.1.tar 3 | source/images/HOST:PORT~jimmidyson~configmap-reload:v0.1.tar 4 | source/images/HOST:PORT~k8s.gcr.io~addon-resizer:1.8.5.tar 5 | source/images/HOST:PORT~prom~alertmanager:v0.14.0.tar 6 | source/images/HOST:PORT~prom~node-exporter:v0.18.1.tar 7 | source/images/HOST:PORT~prom~prometheus:v2.2.1.tar 8 | source/images/HOST:PORT~quay.io~coreos~kube-state-metrics:v1.3.0.tar 9 | source/images/HOST:PORT~k8s.gcr.io~metrics-server-amd64:v0.3.6.tar 10 | source/images/HOST:PORT~kubernetesui~dashboard:v2.0.0-beta6.tar 11 | source/images/HOST:PORT~kubernetesui~metrics-scraper:v1.0.1.tar 12 | source/images/HOST:PORT~google-containers~pause-amd64:3.1.tar 13 | source/images/HOST:PORT~calico~cni:v3.10.1.tar 14 | source/images/HOST:PORT~calico~kube-controllers:v3.10.1.tar 15 | source/images/HOST:PORT~calico~node:v3.10.1.tar 16 | source/images/HOST:PORT~calico~pod2daemon-flexvol:v3.10.1.tar 17 | source/images/HOST:PORT~k8s.gcr.io~coredns:1.6.2.tar 18 | source/images/esn-containers~alpine:latest.tar 19 | source/images/esn-containers~esn_base:1.0.tar 20 | source/images/registry.tar 21 | source/master/usr/bin/kube-apiserver 22 | source/master/usr/bin/kube-controller-manager 23 | source/master/usr/bin/kube-scheduler 24 | source/node/usr/bin/kube-proxy 25 | source/node/usr/bin/kubelet 26 | source/docker/usr/bin/containerd 27 | source/docker/usr/bin/containerd-shim 28 | source/docker/usr/bin/ctr 29 | source/docker/usr/bin/docker 30 | source/docker/usr/bin/dockerd 31 | source/docker/usr/bin/docker-init 32 | source/docker/usr/bin/docker-proxy 33 | source/docker/usr/bin/runc 34 | source/etcd/usr/bin/etcd 35 | source/needbin/usr/local/bin/etcdctl 36 | source/needbin/usr/local/bin/cfssl 37 | source/needbin/usr/local/bin/cfssl-certinfo 38 | source/needbin/usr/local/bin/cfssl-newkey 39 | source/needbin/usr/local/bin/cfssl-scan 40 | source/needbin/usr/local/bin/cfssljson 41 | source/needbin/usr/local/bin/cfssl-bundle 42 | source/needbin/usr/local/bin/kubectl 43 | source/needbin/usr/local/bin/kubeadm 44 | source/needbin/usr/local/bin/kubemark 45 | source/needbin/usr/local/bin/calicoctl -------------------------------------------------------------------------------- /source/bind/etc/named.conf: -------------------------------------------------------------------------------- 1 | // 2 | // named.conf 3 | // 4 | // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS 5 | // server as a caching only nameserver (as a localhost DNS resolver only). 6 | // 7 | // See /usr/share/doc/bind*/sample/ for example named configuration files. 8 | // 9 | // See the BIND Administrator's Reference Manual (ARM) for details about the 10 | // configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html 11 | 12 | options { 13 | listen-on port 53 { any; }; 14 | listen-on-v6 port 53 { ::1; }; 15 | directory "/var/named"; 16 | dump-file "/var/named/data/cache_dump.db"; 17 | statistics-file "/var/named/data/named_stats.txt"; 18 | memstatistics-file "/var/named/data/named_mem_stats.txt"; 19 | allow-query { any; }; 20 | 21 | /* 22 | - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion. 23 | - If you are building a RECURSIVE (caching) DNS server, you need to enable 24 | recursion. 25 | - If your recursive DNS server has a public IP address, you MUST enable access 26 | control to limit queries to your legitimate users. Failing to do so will 27 | cause your server to become part of large scale DNS amplification 28 | attacks. Implementing BCP38 within your network would greatly 29 | reduce such attack surface 30 | */ 31 | recursion yes; 32 | 33 | dnssec-enable no; 34 | dnssec-validation no; 35 | dnssec-lookaside no; 36 | 37 | /* Path to ISC DLV key */ 38 | bindkeys-file "/etc/named.iscdlv.key"; 39 | 40 | managed-keys-directory "/var/named/dynamic"; 41 | 42 | pid-file "/run/named/named.pid"; 43 | session-keyfile "/run/named/session.key"; 44 | }; 45 | 46 | logging { 47 | channel default_debug { 48 | file "data/named.run"; 49 | severity dynamic; 50 | }; 51 | }; 52 | 53 | zone "." IN { 54 | type hint; 55 | file "named.ca"; 56 | }; 57 | 58 | include "/etc/named.rfc1912.zones"; 59 | include "/etc/named.root.key"; 60 | 61 | -------------------------------------------------------------------------------- /source/bind/etc/named.rfc1912.zones: -------------------------------------------------------------------------------- 1 | // named.rfc1912.zones: 2 | // 3 | // Provided by Red Hat caching-nameserver package 4 | // 5 | // ISC BIND named zone configuration for zones recommended by 6 | // RFC 1912 section 4.1 : localhost TLDs and address zones 7 | // and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt 8 | // (c)2007 R W Franks 9 | // 10 | // See /usr/share/doc/bind*/sample/ for example named configuration files. 11 | // 12 | 13 | zone "localhost.localdomain" IN { 14 | type master; 15 | file "named.localhost"; 16 | allow-update { none; }; 17 | }; 18 | 19 | zone "localhost" IN { 20 | type master; 21 | file "named.localhost"; 22 | allow-update { none; }; 23 | }; 24 | 25 | zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN { 26 | type master; 27 | file "named.loopback"; 28 | allow-update { none; }; 29 | }; 30 | 31 | zone "1.0.0.127.in-addr.arpa" IN { 32 | type master; 33 | file "named.loopback"; 34 | allow-update { none; }; 35 | }; 36 | 37 | zone "0.in-addr.arpa" IN { 38 | type master; 39 | file "named.empty"; 40 | allow-update { none; }; 41 | }; 42 | 43 | zone "t.test.com" IN { 44 | type master; 45 | file "zones/t.test.com.zone"; 46 | }; 47 | -------------------------------------------------------------------------------- /source/bind/var/named/zones/t.test.com.zone: -------------------------------------------------------------------------------- 1 | $TTL 1D 2 | @ IN SOA . mail.mydns.com. ( 3 | 0 ; serial 4 | 1D ; refresh 5 | 1H ; retry 6 | 1W ; expire 7 | 3H ) ; minimum 8 | @ IN NS @ 9 | t.test.com. IN A 10.10.10.10 10 | -------------------------------------------------------------------------------- /source/dashboard/dashboard-admin.yaml: -------------------------------------------------------------------------------- 1 | #https://github.com/kubernetes/dashboard/wiki/Access-control#kubeconfig 2 | kind: ClusterRoleBinding 3 | apiVersion: rbac.authorization.k8s.io/v1 4 | metadata: 5 | name: admin 6 | annotations: 7 | rbac.authorization.kubernetes.io/autoupdate: "true" 8 | roleRef: 9 | kind: ClusterRole 10 | name: cluster-admin 11 | apiGroup: rbac.authorization.k8s.io 12 | subjects: 13 | - kind: ServiceAccount 14 | name: admin 15 | namespace: kube-system 16 | 17 | --- 18 | apiVersion: v1 19 | kind: ServiceAccount 20 | metadata: 21 | name: admin 22 | namespace: kube-system 23 | labels: 24 | kubernetes.io/cluster-service: "true" 25 | addonmanager.kubernetes.io/mode: Reconcile 26 | -------------------------------------------------------------------------------- /source/docker/create_ssl.sh.tpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -rf /etc/certs 4 | signdomain=HOST 5 | mkdir -p /etc/certs 6 | cat << EOF > /etc/certs/extfile.cnf 7 | [ v3_ca ] 8 | subjectAltName = IP:$signdomain 9 | subjectKeyIdentifier=hash 10 | authorityKeyIdentifier=keyid:always,issuer 11 | basicConstraints = CA:true 12 | EOF 13 | openssl req -nodes -subj "/C=CN/ST=BeiJing/L=BeiJing/CN=$signdomain" -newkey rsa:4096 -keyout /etc/certs/$signdomain.key -out /etc/certs/$signdomain.csr 14 | openssl x509 -req -days 3650 -in /etc/certs/$signdomain.csr -signkey /etc/certs/$signdomain.key -out /etc/certs/$signdomain.crt -extfile /etc/certs/extfile.cnf -extensions v3_ca 15 | -------------------------------------------------------------------------------- /source/docker/etc/docker/certs.d/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/docker/etc/docker/certs.d/.gitkeep -------------------------------------------------------------------------------- /source/docker/etc/docker/certs.d/HOST:PORT/ca.crt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /source/docker/etc/docker/daemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "storage-driver": "overlay2", 3 | "storage-opts": [ 4 | "overlay2.override_kernel_check=true" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /source/docker/etc/docker/key.json: -------------------------------------------------------------------------------- 1 | {"crv":"P-256","d":"3mO4IuDdYGzipizzzFgLMNJMDCqb5rTRSFAO1mVfKzs","kid":"D6Q5:R7L5:3VUB:GTYJ:JJHZ:46WL:DOSW:ZH4K:G5CS:OEOP:NKZS:46AB","kty":"EC","x":"JYP7ElirFYilUwsYPhSOk5sldvD6F6LOnyS3y8FbP3o","y":"QR_rlX6mpv3n4L4SIOm_Qvt69a0MdDBy15oqPKiIJfQ"} -------------------------------------------------------------------------------- /source/docker/start_registry.sh.tpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p /data/docker/private-registry/{storage,registry} 4 | sha256=`docker load -i /tmp/registry.tar | grep Loaded | awk '{print $4}' | awk -F ':' '{print $2}'` 5 | docker tag $sha256 registry:latest 6 | docker run \ 7 | -d \ 8 | --restart=always \ 9 | --name registry \ 10 | -e STORAGE_PATH=/registry-storage \ 11 | -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/HOST.crt \ 12 | -e REGISTRY_HTTP_TLS_KEY=/certs/HOST.key \ 13 | -v /etc/certs:/certs \ 14 | -v /data/docker/private-registry/storage:/registry-storage \ 15 | -v /data/docker/private-registry/registry:/var/lib/registry \ 16 | -u root \ 17 | -p 5000:5000 \ 18 | registry:latest 19 | -------------------------------------------------------------------------------- /source/docker/usr/lib/systemd/system/docker.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Docker Application Container Engine 3 | Documentation=https://docs.docker.com 4 | After=network-online.target firewalld.service 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | # the default is not to use systemd for cgroups because the delegate issues still 10 | # exists and systemd currently does not support the cgroup feature set required 11 | # for containers run by docker 12 | ExecStart=/usr/bin/dockerd --ip-masq=true -g /data/docker 13 | ExecReload=/bin/kill -s HUP $MAINPID 14 | ExecStartPost=/usr/sbin/iptables -P FORWARD ACCEPT 15 | # Having non-zero Limit*s causes performance problems due to accounting overhead 16 | # in the kernel. We recommend using cgroups to do container-local accounting. 17 | LimitNOFILE=infinity 18 | LimitNPROC=infinity 19 | LimitCORE=infinity 20 | # Uncomment TasksMax if your systemd version supports it. 21 | # Only systemd 226 and above support this version. 22 | #TasksMax=infinity 23 | TimeoutStartSec=0 24 | # set delegate yes so that systemd does not reset the cgroups of docker containers 25 | Delegate=yes 26 | # kill only the docker process, not all processes in the cgroup 27 | KillMode=process 28 | # restart the docker process if it exits prematurely 29 | Restart=on-failure 30 | StartLimitBurst=3 31 | StartLimitInterval=60s 32 | 33 | [Install] 34 | WantedBy=multi-user.target 35 | -------------------------------------------------------------------------------- /source/esn_base/Dockerfile: -------------------------------------------------------------------------------- 1 | # docker build -t="esn-containers/esn_base:1.0" . 2 | 3 | FROM esn-containers/alpine:latest 4 | 5 | LABEL maintainer="shenghua bi " 6 | 7 | ENV TZ 'Asia/Shanghai' 8 | 9 | RUN apk upgrade --no-cache && \ 10 | apk add --no-cache --update bash tzdata git openssh shadow && \ 11 | mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 && \ 12 | ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ 13 | echo "Asia/Shanghai" > /etc/timezone && \ 14 | rm -rf /tmp/* /var/cache/apk/* && \ 15 | rm -rf /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_dsa_key && \ 16 | sed -i "s#umask 022#umask 027#g" /etc/profile && source /etc/profile && \ 17 | mkdir -p /data && chmod 755 /data && useradd -m -d /data/www esn && useradd -m -d /data/www www && chown -R esn:esn /data/www && \ 18 | usermod -G esn www && chmod 750 /data/www && \ 19 | mkdir -p /data/log /data/sess /data/yy_log /data/tmp && \ 20 | mkdir -p /data/log/nginx /data/log/php && \ 21 | chown -R www:www /data/log /data/sess /data/yy_log /data/tmp && \ 22 | chmod 750 /data/www /data//log /data/sess /data/yy_log /data/tmp 23 | 24 | COPY ssh/root /root/.ssh 25 | COPY ssh/esn /data/www/.ssh 26 | COPY docker-entrypoint.sh /usr/local/bin 27 | 28 | RUN chown -R esn:esn /data/www/.ssh && \ 29 | chmod 750 /root/.ssh /data/www/.ssh && \ 30 | chmod 600 /root/.ssh/* /data/www/.ssh/* 31 | 32 | EXPOSE 22 33 | ENTRYPOINT ["docker-entrypoint.sh"] 34 | CMD ["/usr/sbin/sshd", "-D"] 35 | -------------------------------------------------------------------------------- /source/esn_base/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -f "/etc/ssh/ssh_host_rsa_key" ]; then 4 | # generate fresh rsa key 5 | ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa 6 | fi 7 | if [ ! -f "/etc/ssh/ssh_host_dsa_key" ]; then 8 | # generate fresh dsa key 9 | ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa 10 | fi 11 | 12 | # prepare run dir 13 | if [ ! -d "/var/run/sshd" ]; then 14 | mkdir -p /var/run/sshd 15 | fi 16 | 17 | exec "$@" 18 | -------------------------------------------------------------------------------- /source/esn_base/ssh/esn/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSMNZ8HUC1WTDuAH6gpPm+WFT1TIFptsF9cE2knGapDeEbVDPxhewah3e55EymXiQbUDMD5/Xa618hjEsAbJxE45aS9vuuJ2t63g4nj5IPdrKLGemsqhpu6qF+ybNV6eeARKBjii73QmPpq1Ys+NsQoukQQ3QqUNFEdxoqxgckYtgWZcXEK4qWQNqutCVegd5ezwOTfnR2jmUwmqK3YRUl1ci8J/63s1LcNmUiw0yMzQVR8w43D56Hg6oE92EQanQi8bAOju1WVYO9munaNUQIP4e/XBMet++LRBUmKg6PeC8sFZ3CryeRy1WU/ubYNxyK+mYelZsdWb6Od9mwzwNB esn@k8s 2 | -------------------------------------------------------------------------------- /source/esn_base/ssh/esn/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA0jDWfB1AtVkw7gB+oKT5vlhU9UyBabbBfXBNpJxmqQ3hG1Qz 3 | 8YXsGod3ueRMpl4kG1AzA+f12utfIYxLAGycROOWkvb7ridret4OJ4+SD3ayixnp 4 | rKoabuqhfsmzVenngESgY4ou90Jj6atWLPjbEKLpEEN0KlDRRHcaKsYHJGLYFmXF 5 | xCuKlkDarrQlXoHeXs8Dk350do5lMJqit2EVJdXIvCf+t7NS3DZlIsNMjM0FUfMO 6 | Nw+eh4OqBPdhEGp0IvGwDo7tVlWDvZrp2jVECD+Hv1wTHrfvi0QVJioOj3gvLBWd 7 | wq8nkctVlP7m2DccivpmHpWbHVm+jnfZsM8DQQIDAQABAoIBADW2CykeJIny58D5 8 | 2WHdpoAQfG1OhodoDxup1f1phgZPKKXeJ4PhcAr7cQnMoBWnWtyr6s1lufqeSOn+ 9 | uq+6EVi9O54EhR3krt9v3PgZBP70mv1WutLHiQes52XJzwz2P5UUdFPbXNMMYRG2 10 | GchWM0yWBK6GPioOCtvO/53MisiuDpJLVVspVuT3ptKDpEM21hFwUfjzbRJ69YTm 11 | vmF50wR6aqoVJR/GgI4ujO71cm8dXfTlge8gex/tEr8cTf8KDlw66UziykLNea/J 12 | fsPOqgV8tIBWYLjCa8MVyEP0lROSWllAL5YAmutjReARmOGNJzaXXJnSEI0xZfbg 13 | yhJAce0CgYEA+yo6dp4CKJcNJ6WeYWU8DVYh5Nzabx2f1sYqD6KLuGBk8vAkGb4S 14 | YKxTXKM6zpK+BrrB/ThMx1H4V89AZaxhq7agwKA/HGvl4B0PNLLvSQRBrrT6gPKC 15 | lvtpuOaIGQ0CNQPL4+Ns93LYzu2ORFLdshC3m5B6XW/xVM/rguZiH5cCgYEA1jyv 16 | BX30pOaBlhx57MZtzR3Lxy4JOzPYxffpHj6jbgJ1BXuNCkZjE8ajkAjArbkAxvHB 17 | ijyOrg1afIEXQOxHzWMEllhntNNjavzAAkyBGGir5eVMYhxDN8us4NDHUXwr7nRA 18 | uZQrUiIQFfFbfqBYKoIb+fCd13BDavKd/tkPzucCgYBSDU+gJKqL3Bz+EMsXAl2F 19 | 9deIzuXFWyY2ofJnvTBsAYG5I96HUmLqliF9qA20IphV1nk9YkEi9JJvDVP6Y0Bd 20 | OoJ1q2QywsUMXDH1g2dMsUlL6+/SZGdpL6UwNI/Nr0RDUYQwZMHabPiLUWwiwfeP 21 | DosNFTwEfmeWz34e+2ie7QKBgQDN1tBy/mooZjDsAcBD9wNYqOA6J8lG0LHexCt/ 22 | m79623GEKwmAbdCUF67fnQlD4RUWEQJbx4NvR/VA2ud0wZDbjd/CdH5wBwrmqKHz 23 | k34V7bv7zyxst6r92Pvppa9cY2nyWlA1/l8BMykxbAz0xSrw7MHki4Ock4izIRkc 24 | 24GM0QKBgQDVknDGVK+7NyUSw8rmXOnYyKUSLtRV2HcFgYOYbqey7hTWg/iWmhJm 25 | HTMfS5YftVokwr1+wSyN+Z8cIz0vtcw3toGmLKjf6Ig1KP9kIT4kerxOuMbT2cr4 26 | FN277W1DD0WpXhT8Rs+7HwiXOxspM89smBBoVGCi1n9R9gPRiDab3g== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /source/esn_base/ssh/esn/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSMNZ8HUC1WTDuAH6gpPm+WFT1TIFptsF9cE2knGapDeEbVDPxhewah3e55EymXiQbUDMD5/Xa618hjEsAbJxE45aS9vuuJ2t63g4nj5IPdrKLGemsqhpu6qF+ybNV6eeARKBjii73QmPpq1Ys+NsQoukQQ3QqUNFEdxoqxgckYtgWZcXEK4qWQNqutCVegd5ezwOTfnR2jmUwmqK3YRUl1ci8J/63s1LcNmUiw0yMzQVR8w43D56Hg6oE92EQanQi8bAOju1WVYO9munaNUQIP4e/XBMet++LRBUmKg6PeC8sFZ3CryeRy1WU/ubYNxyK+mYelZsdWb6Od9mwzwNB esn@k8s 2 | -------------------------------------------------------------------------------- /source/esn_base/ssh/root/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsk9UP6jBA0WJRB7MOsyGnzCmuTle2IQQGynAfRuDiGVT7u3bgDFMfRkwmlUtq5gUoX+VwceJb3WsyK9YCgqWPKy3qATo7zoocyf5QMyqQAfyj4KSeQxtMNd7VqFfsGhi/F6F9fl215SVb58jDElmim1g6gRWze8rGsbm379blR3Wt0IR+PNYQzBh2ApQ4gh19bIv0IqTh7IvJfMncQjWw1uInBnP4fSJ1wNHH18CRIf4Tab4RqRz3ec0NpFrZwVPlrg+DQ0/3TYd0DdvKl8aK/WFby/XdVUEd8hi8nE6N/iJkbsT4FCoypgZu5iMD3W3n3FnqhN890/CK7iTaay+x esn@k8s 2 | -------------------------------------------------------------------------------- /source/esn_base/ssh/root/id_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEA7JPVD+owQNFiUQezDrMhp8wprk5XtiEEBspwH0bg4hlU+7t2 3 | 4AxTH0ZMJpVLauYFKF/lcHHiW91rMivWAoKljyst6gE6O86KHMn+UDMqkAH8o+Ck 4 | nkMbTDXe1ahX7BoYvxehfX5dteUlW+fIwxJZoptYOoEVs3vKxrG5t+/W5Ud1rdCE 5 | fjzWEMwYdgKUOIIdfWyL9CKk4eyLyXzJ3EI1sNbiJwZz+H0idcDRx9fAkSH+E2m+ 6 | Eakc93nNDaRa2cFT5a4Pg0NP902HdA3bypfGiv1hW8v13VVBHfIYvJxOjf4iZG7E 7 | +BQqMqYGbuYjA91t59xZ6oTfPdPwiu4k2msvsQIDAQABAoIBAQDm3AgRZLW7utfX 8 | PM01rgZMqUWPS/H5z9QPEGNDkjYHTTMKB9CkKELBBSdwi0WyRk6ILLRH+0op3TMr 9 | HW3Uu0r2H+vJK3N5Qz6xg0fBWXzSVK4F+USLD+9Gelc+Ze2Of5TgfR3gyXyG8Np5 10 | CgF2oqSHslHxnV/g6w9gv7P803X/+9BrgUngNks9TPShSgoNEcylHoKdMyjytRiw 11 | aeopSKgqbWBh5ztLLKKG4Z18cX187EzcvjFBy68+rdf0dD0D7SXeb9rQBZwQdri3 12 | uVoDvVfuOiZFjo6rXnuL5NrB4MTNBmGk2O5y2zIgytdVYLmbdRHqORP8ipaKaMj2 13 | 4AtYXva1AoGBAPr22SKFu4i7oKXG7IfcQ3tSBpOq62sigTzkgHEbHTRlezaRaea6 14 | vUQa3jT0H6wtw3wSljeLNd1Pqa0khSw5/DprW7oHX+PmhGsD9qQErr1JsNhaDEG9 15 | DJ15uBJG9gBZyRP+dfGGUzSoxQryoejFYf/xFoTSRs9zVWFRV0DrlQJDAoGBAPFT 16 | FQfsLvCWEY+uJIuqVq8s5x4mpbGxPZbKCySs6RE2tnc3gxBwn4Wiw/LYkRRLYFuo 17 | rWS7gFqnZXW0VpjRQvkIGlPqT9A6EZqFSjyDH7KW0kqaKE66Wi838AIeETSMx5G0 18 | sgt3YiAkVRdUOIsBs+rj+ZoBPDhSHd3xslNccqj7AoGBAIcy+KL6fJ8axV7JnZ9L 19 | cCc9d0GSMKVUv174kqFcRA14Jjqtd+nO7CuGdfL9GRr+xHNQ6BAgNPJ2+ifGpt++ 20 | lT07nPzJAEWcZ/Xm+rY9t41N57GGQVgg6mzjp+BgziI+PG9DBHMLNEQIL67IK6Vk 21 | wHjLfqArT+5uaa61zVWyFGJVAoGAK1Jj4yE2KAB4tJdpfh0dJKNl9hawBh8wVEJ/ 22 | D51u1aVBylMP10KwkHfwv0a7fK4vZST5w6yZVSzZ3PB730EpybT3rPrSSyoxgNDO 23 | y+AqL5A9viDAfamciP98uZSWOB3RscmDcOWEmwqKr/5xjBrJJrC4XTo9ikrLi81Y 24 | 2vgsqUMCgYEA8EGd2VELPczMuurhawJBoFYGWve4W9PNyWVn1wvo9+x4H4SSa0Pf 25 | HWqfwRS05YcRPcQ3L4eW68703qyKAb/gfkDIwPZe+j0lY7Ry55N03EHdP8dlgkl+ 26 | E16RimF2kaS7/i5MdOvrE/sIvSGksy/4bu8l9QGEnPUIaaXu9U8oGac= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /source/esn_base/ssh/root/id_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDsk9UP6jBA0WJRB7MOsyGnzCmuTle2IQQGynAfRuDiGVT7u3bgDFMfRkwmlUtq5gUoX+VwceJb3WsyK9YCgqWPKy3qATo7zoocyf5QMyqQAfyj4KSeQxtMNd7VqFfsGhi/F6F9fl215SVb58jDElmim1g6gRWze8rGsbm379blR3Wt0IR+PNYQzBh2ApQ4gh19bIv0IqTh7IvJfMncQjWw1uInBnP4fSJ1wNHH18CRIf4Tab4RqRz3ec0NpFrZwVPlrg+DQ0/3TYd0DdvKl8aK/WFby/XdVUEd8hi8nE6N/iJkbsT4FCoypgZu5iMD3W3n3FnqhN890/CK7iTaay+x esn@k8s 2 | -------------------------------------------------------------------------------- /source/etcd/ca-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "signing": { 3 | "default": { 4 | "expiry": "175200h" 5 | }, 6 | "profiles": { 7 | "frognew": { 8 | "usages": [ 9 | "signing", 10 | "key encipherment", 11 | "server auth", 12 | "client auth" 13 | ], 14 | "expiry": "175200h" 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/etcd/ca-csr.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "frognew", 3 | "key": { 4 | "algo": "rsa", 5 | "size": 2048 6 | }, 7 | "names": [ 8 | { 9 | "C": "CN", 10 | "ST": "BeiJing", 11 | "L": "BeiJing", 12 | "O": "frognew", 13 | "OU": "cloudnative" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /source/etcd/create_ssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cfssl gencert -initca ca-csr.json | cfssljson -bare ca 4 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew etcd-csr.json | cfssljson -bare etcd 5 | cfssl-certinfo -cert etcd.pem 6 | -------------------------------------------------------------------------------- /source/etcd/etc/etcd/ssl/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/etcd/etc/etcd/ssl/.gitkeep -------------------------------------------------------------------------------- /source/etcd/etcd-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "frognew", 3 | "hosts": [ 4 | "127.0.0.1", 5 | "LVS"HOSTS 6 | ], 7 | "key": { 8 | "algo": "rsa", 9 | "size": 2048 10 | }, 11 | "names": [ 12 | { 13 | "C": "CN", 14 | "ST": "BeiJing", 15 | "L": "BeiJing", 16 | "O": "frognew", 17 | "OU": "cloudnative" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /source/etcd/etcd.service.tpl: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Etcd Server 3 | After=network.target 4 | After=network-online.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | WorkingDirectory=/data/etcd 10 | User=etcd 11 | # set GOMAXPROCS to number of processors 12 | ExecStart=/usr/bin/etcd --name ETCD_NAME --data-dir /data/etcd --listen-client-urls https://0.0.0.0:2379 --listen-peer-urls https://ETCD_HOST:2380 --advertise-client-urls https://ETCD_HOST:2379 --initial-cluster-token etcd-cluster --initial-cluster ETCD_INITIAL_CLUSTER --initial-cluster-state ETCD_INITIAL_CLUSTER_STATE --initial-advertise-peer-urls https://ETCD_HOST:2380 --cert-file /etc/etcd/ssl/etcd.pem --key-file /etc/etcd/ssl/etcd-key.pem --peer-cert-file /etc/etcd/ssl/etcd.pem --peer-key-file /etc/etcd/ssl/etcd-key.pem --trusted-ca-file /etc/etcd/ssl/ca.pem --peer-trusted-ca-file /etc/etcd/ssl/ca.pem --logger=zap 13 | Restart=on-failure 14 | LimitNOFILE=65536 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | 19 | -------------------------------------------------------------------------------- /source/etcd/usr/lib/systemd/system/etcd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Etcd Server 3 | After=network.target 4 | After=network-online.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | WorkingDirectory=/data/etcd/ 10 | EnvironmentFile=-/etc/etcd/etcd.conf 11 | User=etcd 12 | # set GOMAXPROCS to number of processors 13 | ExecStart=/usr/bin/etcd --name=${ETCD_NAME} --data-dir=${ETCD_DATA_DIR} --listen-client-urls=${ETCD_LISTEN_CLIENT_URLS} --listen-peer-urls=${ETCD_LISTEN_PEER_URLS} --advertise-client-urls=${ETCD_ADVERTISE_CLIENT_URLS} --initial-cluster-token=${ETCD_INITIAL_CLUSTER_TOKEN} --initial-cluster=${ETCD_INITIAL_CLUSTER} --initial-cluster-state=${ETCD_INITIAL_CLUSTER_STATE} --initial-advertise-peer-urls=${ETCD_LISTEN_PEER_URLS} --cert-file=/etc/etcd/ssl/etcd.pem --key-file=/etc/etcd/ssl/etcd-key.pem --peer-cert-file=/etc/etcd/ssl/etcd.pem --peer-key-file=/etc/etcd/ssl/etcd-key.pem --trusted-ca-file=/etc/etcd/ssl/ca.pem --peer-trusted-ca-file=/etc/etcd/ssl/ca.pem 14 | Restart=on-failure 15 | LimitNOFILE=65536 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | 20 | -------------------------------------------------------------------------------- /source/master/admin-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "kubernetes-admin", 3 | "hosts": [ 4 | "127.0.0.1", 5 | "LVS"HOSTS 6 | ], 7 | "key": { 8 | "algo": "rsa", 9 | "size": 2048 10 | }, 11 | "names": [ 12 | { 13 | "C": "CN", 14 | "ST": "BeiJing", 15 | "L": "BeiJing", 16 | "O": "system:masters", 17 | "OU": "cloudnative" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /source/master/apiserver-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "kubernetes", 3 | "hosts": [ 4 | "127.0.0.1", 5 | "192.168.0.1", 6 | "192.168.0.2", 7 | "kubernetes", 8 | "kubernetes.default", 9 | "kubernetes.default.svc", 10 | "kubernetes.default.svc.cluster", 11 | "kubernetes.default.svc.cluster.local", 12 | "LVS"HOSTS 13 | ], 14 | "key": { 15 | "algo": "rsa", 16 | "size": 2048 17 | }, 18 | "names": [ 19 | { 20 | "C": "CN", 21 | "ST": "BeiJing", 22 | "L": "BeiJing", 23 | "O": "k8s", 24 | "OU": "cloudnative" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /source/master/apiserver.tpl: -------------------------------------------------------------------------------- 1 | KUBE_API_ADDRESS="--bind-address=0.0.0.0" 2 | KUBE_ETCD_SERVERS="--etcd-servers=https://ETCD_LVS_HOST:2379" 3 | KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=192.168.0.0/16" 4 | KUBE_ADMISSION_CONTROL="--enable-admission-plugins=NamespaceLifecycle,NamespaceExists,LimitRanger,ServiceAccount,PersistentVolumeLabel,ResourceQuota,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook" 5 | KUBE_API_ARGS="--etcd-cafile=/etc/kubernetes/pki/etcd/ca.pem --etcd-certfile=/etc/kubernetes/pki/etcd/etcd.pem --etcd-keyfile=/etc/kubernetes/pki/etcd/etcd-key.pem --tls-cert-file=/etc/kubernetes/pki/apiserver.pem --tls-private-key-file=/etc/kubernetes/pki/apiserver-key.pem --client-ca-file=/etc/kubernetes/pki/ca.pem --service-account-key-file=/etc/kubernetes/pki/ca-key.pem --enable-bootstrap-token-auth=true --authorization-mode=Node,RBAC --kubelet-certificate-authority=/etc/kubernetes/pki/ca.pem --kubelet-client-certificate=/etc/kubernetes/pki/admin.pem --kubelet-client-key=/etc/kubernetes/pki/admin-key.pem --service-node-port-range=1-65535 --requestheader-allowed-names=aggregator --requestheader-client-ca-file=/etc/kubernetes/pki/ca.pem --requestheader-allowed-names=aggregator --requestheader-extra-headers-prefix=X-Remote-Extra- --requestheader-group-headers=X-Remote-Group --requestheader-username-headers=X-Remote-User --proxy-client-cert-file=/etc/kubernetes/pki/metrics-server.pem --proxy-client-key-file=/etc/kubernetes/pki/metrics-server-key.pem --enable-aggregator-routing=true" 6 | -------------------------------------------------------------------------------- /source/master/ca-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "signing": { 3 | "default": { 4 | "expiry": "175200h" 5 | }, 6 | "profiles": { 7 | "frognew": { 8 | "usages": [ 9 | "signing", 10 | "key encipherment", 11 | "server auth", 12 | "client auth" 13 | ], 14 | "expiry": "175200h" 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/master/ca-config.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "signing": { 3 | "default": { 4 | "expiry": "175200h" 5 | }, 6 | "profiles": { 7 | "frognew": { 8 | "usages": [ 9 | "signing", 10 | "key encipherment", 11 | "server auth", 12 | "client auth" 13 | ], 14 | "expiry": "175200h" 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/master/ca-csr.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "kubernetes", 3 | "key": { 4 | "algo": "rsa", 5 | "size": 2048 6 | }, 7 | "names": [ 8 | { 9 | "C": "CN", 10 | "ST": "BeiJing", 11 | "L": "BeiJing", 12 | "O": "k8s", 13 | "OU": "cloudnative" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /source/master/config.tpl: -------------------------------------------------------------------------------- 1 | KUBE_LOGTOSTDERR="--logtostderr=true" 2 | KUBE_LOG_LEVEL="--v=0" 3 | KUBE_ALLOW_PRIV="--allow-privileged=true" 4 | KUBE_MASTER="--master=https://K8S_HOST:6443" 5 | -------------------------------------------------------------------------------- /source/master/controller-manager-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "system:kube-controller-manager", 3 | "hosts": [ 4 | "127.0.0.1", 5 | "LVS"HOSTS 6 | ], 7 | "key": { 8 | "algo": "rsa", 9 | "size": 2048 10 | }, 11 | "names": [ 12 | { 13 | "C": "CN", 14 | "ST": "BeiJing", 15 | "L": "BeiJing", 16 | "O": "system:kube-controller-manager", 17 | "OU": "cloudnative" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /source/master/create_ssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cfssl gencert -initca ca-csr.json | cfssljson -bare ca 4 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew admin-csr.json | cfssljson -bare admin 5 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew apiserver-csr.json | cfssljson -bare apiserver 6 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew controller-manager-csr.json | cfssljson -bare controller-manager 7 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew scheduler-csr.json | cfssljson -bare scheduler 8 | cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=frognew metrics-server-csr.json | cfssljson -bare metrics-server 9 | -------------------------------------------------------------------------------- /source/master/etc/kubernetes/controller-manager: -------------------------------------------------------------------------------- 1 | KUBE_CONTROLLER_MANAGER_ARGS="--kubeconfig=/etc/kubernetes/controller-manager.conf --cluster-name=kubernetes --cluster-signing-cert-file=/etc/kubernetes/pki/ca.pem --cluster-signing-key-file=/etc/kubernetes/pki/ca-key.pem --service-account-private-key-file=/etc/kubernetes/pki/ca-key.pem --root-ca-file=/etc/kubernetes/pki/ca.pem --use-service-account-credentials=true --leader-elect=true --controllers=*,bootstrapsigner,tokencleaner --service-cluster-ip-range=192.168.0.0/16" 2 | -------------------------------------------------------------------------------- /source/master/etc/kubernetes/pki/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/master/etc/kubernetes/pki/.gitkeep -------------------------------------------------------------------------------- /source/master/etc/kubernetes/scheduler: -------------------------------------------------------------------------------- 1 | KUBE_SCHEDULER_ARGS="--kubeconfig=/etc/kubernetes/scheduler.conf --leader-elect=true" 2 | -------------------------------------------------------------------------------- /source/master/metrics-server-csr.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "aggregator", 3 | "hosts": [], 4 | "key": { 5 | "algo": "rsa", 6 | "size": 2048 7 | }, 8 | "names": [ 9 | { 10 | "C": "CN", 11 | "ST": "BeiJing", 12 | "L": "BeiJing", 13 | "O": "k8s", 14 | "OU": "4Paradigm" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /source/master/scheduler-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "system:kube-scheduler", 3 | "hosts": [ 4 | "127.0.0.1", 5 | "LVS"HOSTS 6 | ], 7 | "key": { 8 | "algo": "rsa", 9 | "size": 2048 10 | }, 11 | "names": [ 12 | { 13 | "C": "CN", 14 | "ST": "BeiJing", 15 | "L": "BeiJing", 16 | "O": "system:kube-scheduler", 17 | "OU": "cloudnative" 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /source/master/usr/lib/systemd/system/kube-apiserver.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kubernetes API Server 3 | Documentation=https://github.com/kubernetes 4 | 5 | [Service] 6 | EnvironmentFile=-/etc/kubernetes/config 7 | EnvironmentFile=-/etc/kubernetes/apiserver 8 | ExecStart=/usr/bin/kube-apiserver \ 9 | $KUBE_LOGTOSTDERR \ 10 | $KUBE_LOG_LEVEL \ 11 | $KUBE_ETCD_SERVERS \ 12 | $KUBE_API_ADDRESS \ 13 | $KUBELET_PORT \ 14 | $KUBE_ALLOW_PRIV \ 15 | $KUBE_SERVICE_ADDRESSES \ 16 | $KUBE_ADMISSION_CONTROL \ 17 | $KUBE_API_ARGS 18 | Restart=on-failure 19 | Type=notify 20 | LimitNOFILE=65536 21 | 22 | [Install] 23 | WantedBy=multi-user.target 24 | -------------------------------------------------------------------------------- /source/master/usr/lib/systemd/system/kube-controller-manager.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kubernetes Controller Manager 3 | Documentation=https://github.com/kubernetes 4 | After=kube-apiserver.service 5 | Requires=kube-apiserver.service 6 | 7 | [Service] 8 | EnvironmentFile=-/etc/kubernetes/config 9 | EnvironmentFile=-/etc/kubernetes/controller-manager 10 | ExecStart=/usr/bin/kube-controller-manager \ 11 | $KUBE_LOGTOSTDERR \ 12 | $KUBE_LOG_LEVEL \ 13 | $KUBE_MASTER \ 14 | $KUBE_CONTROLLER_MANAGER_ARGS 15 | Restart=on-failure 16 | LimitNOFILE=65536 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /source/master/usr/lib/systemd/system/kube-scheduler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kubernetes Scheduler 3 | Documentation=https://github.com/kubernetes 4 | After=kube-apiserver.service 5 | Requires=kube-apiserver.service 6 | 7 | [Service] 8 | EnvironmentFile=-/etc/kubernetes/config 9 | EnvironmentFile=-/etc/kubernetes/scheduler 10 | ExecStart=/usr/bin/kube-scheduler \ 11 | $KUBE_LOGTOSTDERR \ 12 | $KUBE_LOG_LEVEL \ 13 | $KUBE_MASTER \ 14 | $KUBE_SCHEDULER_ARGS 15 | Restart=on-failure 16 | LimitNOFILE=65536 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /source/metrics-server/auth-delegator.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: metrics-server:system:auth-delegator 5 | labels: 6 | kubernetes.io/cluster-service: "true" 7 | addonmanager.kubernetes.io/mode: Reconcile 8 | roleRef: 9 | apiGroup: rbac.authorization.k8s.io 10 | kind: ClusterRole 11 | name: system:auth-delegator 12 | subjects: 13 | - kind: ServiceAccount 14 | name: metrics-server 15 | namespace: kube-system 16 | -------------------------------------------------------------------------------- /source/metrics-server/auth-reader.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: metrics-server-auth-reader 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: Reconcile 9 | roleRef: 10 | apiGroup: rbac.authorization.k8s.io 11 | kind: Role 12 | name: extension-apiserver-authentication-reader 13 | subjects: 14 | - kind: ServiceAccount 15 | name: metrics-server 16 | namespace: kube-system 17 | -------------------------------------------------------------------------------- /source/metrics-server/metrics-apiservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiregistration.k8s.io/v1 2 | kind: APIService 3 | metadata: 4 | name: v1beta1.metrics.k8s.io 5 | labels: 6 | kubernetes.io/cluster-service: "true" 7 | addonmanager.kubernetes.io/mode: Reconcile 8 | spec: 9 | service: 10 | name: metrics-server 11 | namespace: kube-system 12 | group: metrics.k8s.io 13 | version: v1beta1 14 | insecureSkipTLSVerify: true 15 | groupPriorityMinimum: 100 16 | versionPriority: 100 17 | -------------------------------------------------------------------------------- /source/metrics-server/metrics-server-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: metrics-server 5 | namespace: kube-system 6 | labels: 7 | addonmanager.kubernetes.io/mode: Reconcile 8 | kubernetes.io/cluster-service: "true" 9 | kubernetes.io/name: "Metrics-server" 10 | spec: 11 | selector: 12 | k8s-app: metrics-server 13 | ports: 14 | - port: 443 15 | protocol: TCP 16 | targetPort: https 17 | -------------------------------------------------------------------------------- /source/metrics-server/resource-reader.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: system:metrics-server 5 | labels: 6 | kubernetes.io/cluster-service: "true" 7 | addonmanager.kubernetes.io/mode: Reconcile 8 | rules: 9 | - apiGroups: 10 | - "" 11 | resources: 12 | - pods 13 | - nodes 14 | - nodes/stats 15 | - namespaces 16 | verbs: 17 | - get 18 | - list 19 | - watch 20 | - apiGroups: 21 | - "extensions" 22 | resources: 23 | - deployments 24 | verbs: 25 | - get 26 | - list 27 | - update 28 | - watch 29 | --- 30 | apiVersion: rbac.authorization.k8s.io/v1 31 | kind: ClusterRoleBinding 32 | metadata: 33 | name: system:metrics-server 34 | labels: 35 | kubernetes.io/cluster-service: "true" 36 | addonmanager.kubernetes.io/mode: Reconcile 37 | roleRef: 38 | apiGroup: rbac.authorization.k8s.io 39 | kind: ClusterRole 40 | name: system:metrics-server 41 | subjects: 42 | - kind: ServiceAccount 43 | name: metrics-server 44 | namespace: kube-system 45 | -------------------------------------------------------------------------------- /source/node/ca-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "signing": { 3 | "default": { 4 | "expiry": "175200h" 5 | }, 6 | "profiles": { 7 | "frognew": { 8 | "usages": [ 9 | "signing", 10 | "key encipherment", 11 | "server auth", 12 | "client auth" 13 | ], 14 | "expiry": "175200h" 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/node/config.tpl: -------------------------------------------------------------------------------- 1 | KUBE_LOGTOSTDERR="--logtostderr=true" 2 | KUBE_LOG_LEVEL="--v=0" 3 | KUBE_ALLOW_PRIV="--allow-privileged=true" 4 | KUBE_MASTER="--master=https://K8S_MASTER_LVS:6443" 5 | -------------------------------------------------------------------------------- /source/node/etc/kubernetes/kube-proxy.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kubeproxy.config.k8s.io/v1alpha1 2 | bindAddress: 127.0.0.1 3 | clientConnection: 4 | acceptContentTypes: "" 5 | burst: 10 6 | contentType: application/vnd.kubernetes.protobuf 7 | kubeconfig: /etc/kubernetes/kube-proxy.conf 8 | qps: 5 9 | clusterCIDR: "" 10 | configSyncPeriod: 15m0s 11 | conntrack: 12 | max: 0 13 | maxPerCore: 32768 14 | min: 2621440 15 | tcpCloseWaitTimeout: 1h0m0s 16 | tcpEstablishedTimeout: 24h0m0s 17 | enableProfiling: false 18 | healthzBindAddress: 127.0.0.1:10256 19 | hostnameOverride: "" 20 | iptables: 21 | masqueradeAll: false 22 | masqueradeBit: 14 23 | minSyncPeriod: 0s 24 | syncPeriod: 30s 25 | ipvs: 26 | excludeCIDRs: null 27 | minSyncPeriod: 0s 28 | scheduler: "" 29 | syncPeriod: 30s 30 | kind: KubeProxyConfiguration 31 | metricsBindAddress: 127.0.0.1:10249 32 | mode: iptables 33 | nodePortAddresses: null 34 | oomScoreAdj: -999 35 | portRange: "" 36 | resourceContainer: /kube-proxy 37 | udpIdleTimeout: 250ms 38 | -------------------------------------------------------------------------------- /source/node/etc/kubernetes/manifests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/node/etc/kubernetes/manifests/.gitkeep -------------------------------------------------------------------------------- /source/node/etc/kubernetes/pki/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/node/etc/kubernetes/pki/.gitkeep -------------------------------------------------------------------------------- /source/node/etc/kubernetes/proxy: -------------------------------------------------------------------------------- 1 | KUBELET_PROXY_ARGS="--config=/etc/kubernetes/kube-proxy.yaml" 2 | -------------------------------------------------------------------------------- /source/node/kube-proxy-csr.json: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "system:kube-proxy", 3 | "hosts": [ 4 | ], 5 | "key": { 6 | "algo": "rsa", 7 | "size": 2048 8 | }, 9 | "names": [ 10 | { 11 | "C": "CN", 12 | "ST": "BeiJing", 13 | "L": "BeiJing", 14 | "O": "system:kube-proxy", 15 | "OU": "cloudnative" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /source/node/kubelet-csr.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "CN": "system:node:NODE_HOST", 3 | "hosts": [ 4 | "NODE_HOST" 5 | ], 6 | "key": { 7 | "algo": "rsa", 8 | "size": 2048 9 | }, 10 | "names": [ 11 | { 12 | "C": "CN", 13 | "ST": "BeiJing", 14 | "L": "BeiJing", 15 | "O": "system:nodes", 16 | "OU": "cloudnative" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /source/node/kubelet.tpl: -------------------------------------------------------------------------------- 1 | KUBELET_HOSTNAME="--hostname-override=NODE_HOST" 2 | KUBELET_PAUSE_IMAGE="--pod-infra-container-image=PRI_DOCKER_HOST:5000/google-containers/pause-amd64:3.1" 3 | KUBELET_ARGS="--kubeconfig=/etc/kubernetes/kubelet.conf --config=/etc/kubernetes/kubelet.yaml" 4 | -------------------------------------------------------------------------------- /source/node/kubelet.yaml.tpl: -------------------------------------------------------------------------------- 1 | kind: KubeletConfiguration 2 | apiVersion: kubelet.config.k8s.io/v1beta1 3 | featureGates: 4 | RotateKubeletServerCertificate: true 5 | address: "NODE_HOST" 6 | staticPodPath: "/etc/kubernetes/manifests" 7 | clusterDNS: ["192.168.0.2"] 8 | clusterDomain: "cluster.local" 9 | tlsCertFile: "/etc/kubernetes/pki/kubelet.pem" 10 | tlsPrivateKeyFile: "/etc/kubernetes/pki/kubelet-key.pem" 11 | authorization: 12 | mode: Webhook 13 | webhook: 14 | cacheAuthorizedTTL: "5m0s" 15 | cacheUnauthorizedTTL: "30s" 16 | authentication: 17 | x509: 18 | clientCAFile: "/etc/kubernetes/pki/ca.pem" 19 | webhook: 20 | enabled: false 21 | cacheTTL: "0s" 22 | anonymous: 23 | enabled: false 24 | cgroupDriver: "cgroupfs" 25 | tlsMinVersion: "VersionTLS12" 26 | tlsCipherSuites: 27 | - "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" 28 | - "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" 29 | - "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" 30 | - "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" 31 | readOnlyPort: 10255 32 | port: 10250 33 | # containerLogMaxSize: "10Mi" 34 | # containerLogMaxFiles: 5 35 | # evictionHard: 36 | # imagefs.available: "15%" 37 | # memory.available: "100Mi" 38 | # nodefs.available: "10%" 39 | # nodefs.inodesFree: "5%" 40 | # evictionMaxPodGracePeriod: 0 41 | # evictionPressureTransitionPeriod: "5m0s" 42 | # fileCheckFrequency: "20s" 43 | # imageGCHighThresholdPercent: 85 44 | # imageGCLowThresholdPercent: 80 45 | # maxOpenFiles: 1000000 46 | maxPods: 300 47 | failSwapOn: false 48 | # imageMinimumGCAge: "2m0s" 49 | # nodeStatusUpdateFrequency: "10s" 50 | # runtimeRequestTimeout: "2m0s" 51 | # streamingConnectionIdleTimeout: "4h0m0s" 52 | # syncFrequency: "1m0s" 53 | # volumeStatsAggPeriod: "1m0s" 54 | -------------------------------------------------------------------------------- /source/node/usr/lib/systemd/system/kube-proxy.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kubernetes kube-proxy Server 3 | Documentation=https://github.com/kubernetes 4 | After=network.target 5 | Requires=network.target 6 | 7 | [Service] 8 | EnvironmentFile=-/etc/kubernetes/config 9 | EnvironmentFile=-/etc/kubernetes/proxy 10 | ExecStart=/usr/bin/kube-proxy \ 11 | $KUBE_LOGTOSTDERR \ 12 | $KUBE_LOG_LEVEL \ 13 | $KUBE_MASTER \ 14 | $KUBELET_PROXY_ARGS 15 | Restart=on-failure 16 | LimitNOFILE=65536 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /source/node/usr/lib/systemd/system/kubelet.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Kubernetes Kubelet Server 3 | Documentation=https://github.com/kubernetes 4 | After=docker.service 5 | Requires=docker.service 6 | 7 | [Service] 8 | WorkingDirectory=/data/kubelet 9 | EnvironmentFile=-/etc/kubernetes/config 10 | EnvironmentFile=-/etc/kubernetes/kubelet 11 | ExecStart=/usr/bin/kubelet \ 12 | $KUBE_LOGTOSTDERR \ 13 | $KUBE_LOG_LEVEL \ 14 | $KUBELET_HOSTNAME \ 15 | $KUBELET_PAUSE_IMAGE \ 16 | $KUBELET_ARGS 17 | Restart=on-failure 18 | LimitNOFILE=65536 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /source/prometheus/alertmanager-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: alertmanager-config 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: EnsureExists 9 | data: 10 | alertmanager.yml: | 11 | global: null 12 | receivers: 13 | - name: default-receiver 14 | route: 15 | group_interval: 5m 16 | group_wait: 10s 17 | receiver: default-receiver 18 | repeat_interval: 3h 19 | -------------------------------------------------------------------------------- /source/prometheus/alertmanager-deployment.yaml.tpl: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: alertmanager 5 | namespace: kube-system 6 | labels: 7 | k8s-app: alertmanager 8 | kubernetes.io/cluster-service: "true" 9 | addonmanager.kubernetes.io/mode: Reconcile 10 | version: v0.14.0 11 | spec: 12 | replicas: 1 13 | selector: 14 | matchLabels: 15 | k8s-app: alertmanager 16 | version: v0.14.0 17 | template: 18 | metadata: 19 | labels: 20 | k8s-app: alertmanager 21 | version: v0.14.0 22 | spec: 23 | priorityClassName: system-cluster-critical 24 | containers: 25 | - name: prometheus-alertmanager 26 | image: "PRI_DOCKER_HOST:5000/prom/alertmanager:v0.14.0" 27 | imagePullPolicy: "IfNotPresent" 28 | args: 29 | - --config.file=/etc/config/alertmanager.yml 30 | - --storage.path=/data 31 | - --web.external-url=/ 32 | ports: 33 | - containerPort: 9093 34 | readinessProbe: 35 | httpGet: 36 | path: /#/status 37 | port: 9093 38 | initialDelaySeconds: 30 39 | timeoutSeconds: 30 40 | volumeMounts: 41 | - name: config-volume 42 | mountPath: /etc/config 43 | - name: storage-volume 44 | mountPath: "/data" 45 | subPath: "" 46 | resources: 47 | limits: 48 | cpu: 10m 49 | memory: 50Mi 50 | requests: 51 | cpu: 10m 52 | memory: 50Mi 53 | - name: prometheus-alertmanager-configmap-reload 54 | image: "PRI_DOCKER_HOST:5000/jimmidyson/configmap-reload:v0.1" 55 | imagePullPolicy: "IfNotPresent" 56 | args: 57 | - --volume-dir=/etc/config 58 | - --webhook-url=http://localhost:9093/-/reload 59 | volumeMounts: 60 | - name: config-volume 61 | mountPath: /etc/config 62 | readOnly: true 63 | resources: 64 | limits: 65 | cpu: 10m 66 | memory: 10Mi 67 | requests: 68 | cpu: 10m 69 | memory: 10Mi 70 | volumes: 71 | - name: config-volume 72 | configMap: 73 | name: alertmanager-config 74 | - name: storage-volume 75 | persistentVolumeClaim: 76 | claimName: alertmanager 77 | -------------------------------------------------------------------------------- /source/prometheus/alertmanager-pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: alertmanager 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: EnsureExists 9 | spec: 10 | storageClassName: alertmanager 11 | accessModes: 12 | - ReadWriteOnce 13 | resources: 14 | requests: 15 | storage: "2Gi" 16 | -------------------------------------------------------------------------------- /source/prometheus/alertmanager-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: alertmanager 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: Reconcile 9 | kubernetes.io/name: "Alertmanager" 10 | spec: 11 | ports: 12 | - name: http 13 | port: 80 14 | protocol: TCP 15 | targetPort: 9093 16 | selector: 17 | k8s-app: alertmanager 18 | type: "ClusterIP" 19 | -------------------------------------------------------------------------------- /source/prometheus/grafana/grafana.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/grafana.db -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/.gitattributes: -------------------------------------------------------------------------------- 1 | # Don't diff files in dist/ 2 | *.map binary 3 | dist/** binary 4 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | .tscache 40 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | require('load-grunt-tasks')(grunt); 3 | 4 | grunt.loadNpmTasks('grunt-contrib-clean'); 5 | grunt.loadNpmTasks('grunt-typescript'); 6 | grunt.loadNpmTasks('grunt-contrib-watch'); 7 | 8 | 9 | grunt.initConfig({ 10 | clean: ['dist'], 11 | 12 | copy: { 13 | dist_js: { 14 | expand: true, 15 | cwd: 'src', 16 | src: ['**/*.ts', '**/*.d.ts'], 17 | dest: 'dist' 18 | }, 19 | dist_html: { 20 | expand: true, 21 | cwd: 'src', 22 | src: ['**/*.html', '**/*.json'], 23 | dest: 'dist' 24 | }, 25 | dist_css: { 26 | expand: true, 27 | flatten: true, 28 | cwd: 'src/css', 29 | src: ['*.css'], 30 | dest: 'dist/css/' 31 | }, 32 | dist_img: { 33 | expand: true, 34 | flatten: true, 35 | cwd: 'src/img', 36 | src: ['*.*'], 37 | dest: 'dist/img/' 38 | }, 39 | dist_statics: { 40 | expand: true, 41 | flatten: true, 42 | src: ['src/plugin.json', 'LICENSE', 'README.md', 'src/query_help.md'], 43 | dest: 'dist/' 44 | } 45 | }, 46 | 47 | typescript: { 48 | build: { 49 | src: ['dist/**/*.ts', '!**/*.d.ts'], 50 | dest: 'dist', 51 | options: { 52 | module: 'system', 53 | target: 'es5', 54 | rootDir: 'dist/', 55 | declaration: true, 56 | emitDecoratorMetadata: true, 57 | experimentalDecorators: true, 58 | sourceMap: true, 59 | noImplicitAny: false, 60 | } 61 | } 62 | }, 63 | 64 | sass: { 65 | options: { 66 | sourceMap: true 67 | }, 68 | dist: { 69 | files: { 70 | "dist/css/kubernetes.dark.css": "src/sass/kubernetes.dark.scss", 71 | "dist/css/kubernetes.light.css": "src/sass/kubernetes.light.scss", 72 | } 73 | } 74 | }, 75 | 76 | watch: { 77 | files: ['src/**/*.ts', 'src/**/*.html', 'src/**/*.css', 'src/img/*.*', 'src/plugin.json', 'README.md', 'src/query_help.md'], 78 | tasks: ['default'], 79 | options: { 80 | debounceDelay: 250, 81 | }, 82 | } 83 | }); 84 | 85 | grunt.registerTask('default', [ 86 | 'clean', 87 | 'copy:dist_js', 88 | 'sass', 89 | 'typescript:build', 90 | 'copy:dist_html', 91 | 'copy:dist_css', 92 | 'copy:dist_img', 93 | 'copy:dist_statics' 94 | ]); 95 | }; -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusterConfig.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class ClusterConfigCtrl { 3 | private backendSrv; 4 | private $q; 5 | private contextSrv; 6 | private $location; 7 | private $window; 8 | private alertSrv; 9 | cluster: any; 10 | isOrgEditor: boolean; 11 | pageReady: boolean; 12 | prometheusDeployed: boolean; 13 | showHelp: boolean; 14 | showPrometheusExample: boolean; 15 | datasources: [any]; 16 | static templateUrl: string; 17 | /** @ngInject */ 18 | constructor($scope: any, $injector: any, backendSrv: any, $q: any, contextSrv: any, $location: any, $window: any, alertSrv: any); 19 | toggleHelp(): void; 20 | togglePrometheusExample(): void; 21 | getDatasources(): any; 22 | getCluster(id: any): any; 23 | getPrometheusDatasources(): any; 24 | getDeployments(): any; 25 | save(): any; 26 | savePrometheusConfigToFile(): void; 27 | saveNodeExporterDSToFile(): void; 28 | saveKubeStateDeployToFile(): void; 29 | saveToFile(filename: any, blob: any): void; 30 | deploy(): void; 31 | undeploy(): void; 32 | saveDatasource(): any; 33 | saveAndDeploy(): any; 34 | checkApiVersion(clusterId: any): any; 35 | createConfigMap(clusterId: any, cm: any): any; 36 | createDaemonSet(clusterId: any, daemonSet: any): any; 37 | deleteDaemonSet(clusterId: any): any; 38 | createDeployment(clusterId: any, deployment: any): any; 39 | deleteDeployment(clusterId: any, deploymentName: any): any; 40 | deleteConfigMap(clusterId: any, cmName: any): any; 41 | deletePods(): any; 42 | cancel(): void; 43 | deployPrometheus(): any; 44 | undeployPrometheus(): any; 45 | generatePrometheusConfig(): string; 46 | generatePrometheusConfigMap(): { 47 | "apiVersion": string; 48 | "kind": string; 49 | "metadata": { 50 | "name": string; 51 | }; 52 | "data": { 53 | "prometheus.yml": string; 54 | }; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusterInfo.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class ClusterInfoCtrl { 3 | private backendSrv; 4 | private datasourceSrv; 5 | private $q; 6 | private $location; 7 | private alertSrv; 8 | cluster: any; 9 | pageReady: boolean; 10 | componentStatuses: any; 11 | namespaces: string[]; 12 | namespace: string; 13 | nodes: any[]; 14 | datasources: any; 15 | clusterDS: any; 16 | static templateUrl: string; 17 | /** @ngInject */ 18 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $q: any, $location: any, alertSrv: any); 19 | getCluster(id: any): any; 20 | getClusterInfo(): void; 21 | goToClusterDashboard(): void; 22 | goToPodDashboard(): void; 23 | goToNodeDashboard(node: any, evt: any): void; 24 | goToWorkloads(ns: any, evt: any): void; 25 | goToNodeInfo(node: any, evt: any): void; 26 | } 27 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusterWorkloads.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class ClusterWorkloadsCtrl { 3 | private backendSrv; 4 | private datasourceSrv; 5 | private $q; 6 | private $location; 7 | private alertSrv; 8 | pageReady: boolean; 9 | cluster: any; 10 | namespaces: string[]; 11 | namespace: string; 12 | daemonSets: any[]; 13 | replicationControllers: any[]; 14 | deployments: any[]; 15 | pods: any[]; 16 | clusterDS: any; 17 | static templateUrl: string; 18 | /** @ngInject */ 19 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $q: any, $location: any, alertSrv: any); 20 | getCluster(id: any): any; 21 | getWorkloads(): void; 22 | componentHealth(component: any): string; 23 | isComponentHealthy(component: any): boolean; 24 | goToPodDashboard(pod: any): void; 25 | goToDeploymentDashboard(deploy: any): void; 26 | goToPodInfo(pod: any, evt: any): void; 27 | } 28 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusters.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class ClustersCtrl { 3 | private backendSrv; 4 | private contextSrv; 5 | private $location; 6 | cluster: any; 7 | pageReady: boolean; 8 | datasources: [any]; 9 | clusters: {}; 10 | isOrgEditor: boolean; 11 | static templateUrl: string; 12 | /** @ngInject */ 13 | constructor($scope: any, $injector: any, backendSrv: any, contextSrv: any, $location: any); 14 | getClusters(): any; 15 | confirmDelete(id: any): void; 16 | deleteCluster(cluster: any): void; 17 | clusterInfo(cluster: any): void; 18 | } 19 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusters.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"clusters.js","sourceRoot":"","sources":["clusters.ts"],"names":["ClustersCtrl","ClustersCtrl.constructor","ClustersCtrl.getClusters","ClustersCtrl.confirmDelete","ClustersCtrl.deleteCluster","ClustersCtrl.clusterInfo"],"mappings":"AAAA,uFAAuF;;;;;;;;;;;;;YAKvF;gBASEA,gBAAgBA;gBAChBA,sBAAYA,MAAMA,EAAEA,SAASA,EAAUA,UAAUA,EAAUA,UAAUA,EAAUA,SAASA;oBAAjDC,eAAUA,GAAVA,UAAUA,CAAAA;oBAAUA,eAAUA,GAAVA,UAAUA,CAAAA;oBAAUA,cAASA,GAATA,SAASA,CAAAA;oBACtFA,IAAIA,IAAIA,GAAGA,IAAIA,CAACA;oBAChBA,IAAIA,CAACA,WAAWA,GAAGA,UAAUA,CAACA,OAAOA,CAACA,QAAQA,CAACA,IAAIA,UAAUA,CAACA,OAAOA,CAACA,OAAOA,CAACA,CAACA;oBAC/EA,QAAQA,CAACA,KAAKA,GAAGA,wBAAwBA,CAACA;oBAC1CA,IAAIA,CAACA,QAAQA,GAAGA,EAAEA,CAACA;oBACnBA,IAAIA,CAACA,SAASA,GAAGA,KAAKA,CAACA;oBACvBA,IAAIA,CAACA,WAAWA,EAAEA,CAACA,IAAIA,CAACA;wBACtBA,IAAIA,CAACA,SAASA,GAAGA,IAAIA,CAACA;oBACxBA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAEDD,kCAAWA,GAAXA;oBACEE,IAAIA,IAAIA,GAAGA,IAAIA,CAACA;oBAChBA,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,GAAGA,CAACA,kBAAkBA,CAACA;yBAC7CA,IAAIA,CAACA,UAACA,MAAMA;wBACXA,IAAIA,CAACA,QAAQA,GAAGA,gBAACA,CAACA,MAAMA,CAACA,MAAMA,EAAEA,EAACA,MAAMA,EAAEA,+BAA+BA,EAACA,CAACA,CAACA;oBAC9EA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAEDF,oCAAaA,GAAbA,UAAcA,EAAEA;oBAAhBG,iBAICA;oBAHCA,IAAIA,CAACA,UAAUA,CAACA,MAAMA,CAACA,mBAAmBA,GAAGA,EAAEA,CAACA,CAACA,IAAIA,CAACA;wBACpDA,KAAIA,CAACA,WAAWA,EAAEA,CAACA;oBACrBA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAEDH,oCAAaA,GAAbA,UAAcA,OAAOA;oBAArBI,iBAWCA;oBAVCA,oBAASA,CAACA,IAAIA,CAACA,eAAeA,EAAEA;wBAC9BA,KAAKA,EAAEA,QAAQA;wBACfA,IAAIA,EAAEA,oDAAoDA;4BACxDA,uFAAuFA;wBACzFA,OAAOA,EAAEA,QAAQA;wBACjBA,IAAIA,EAAEA,UAAUA;wBAChBA,SAASA,EAAEA;4BACTA,KAAIA,CAACA,aAAaA,CAACA,OAAOA,CAACA,EAAEA,CAACA,CAACA;wBACjCA,CAACA;qBACFA,CAACA,CAACA;gBACLA,CAACA;gBAEDJ,kCAAWA,GAAXA,UAAYA,OAAOA;oBACjBK,IAAIA,CAACA,SAASA,CAACA,IAAIA,CAACA,kDAAkDA,CAACA,CAACA,MAAMA,CAACA,EAACA,SAASA,EAAEA,OAAOA,CAACA,EAAEA,EAACA,CAACA,CAACA;gBAC1GA,CAACA;gBA3CML,wBAAWA,GAAGA,4CAA4CA,CAACA;gBA4CpEA,mBAACA;YAADA,CAACA,AAnDD,IAmDC;YAnDD,uCAmDC,CAAA"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/clusters.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import _ from 'lodash'; 4 | import appEvents from 'app/core/app_events'; 5 | 6 | export class ClustersCtrl { 7 | cluster: any; 8 | pageReady: boolean; 9 | datasources: [any]; 10 | clusters: {}; 11 | isOrgEditor: boolean; 12 | 13 | static templateUrl = 'components/clusters/partials/clusters.html'; 14 | 15 | /** @ngInject */ 16 | constructor($scope, $injector, private backendSrv, private contextSrv, private $location) { 17 | var self = this; 18 | this.isOrgEditor = contextSrv.hasRole('Editor') || contextSrv.hasRole('Admin'); 19 | document.title = 'Grafana Kubernetes App'; 20 | this.clusters = {}; 21 | this.pageReady = false; 22 | this.getClusters().then(() => { 23 | self.pageReady = true; 24 | }); 25 | } 26 | 27 | getClusters() { 28 | var self = this; 29 | return this.backendSrv.get('/api/datasources') 30 | .then((result) => { 31 | self.clusters = _.filter(result, {"type": "grafana-kubernetes-datasource"}); 32 | }); 33 | } 34 | 35 | confirmDelete(id) { 36 | this.backendSrv.delete('/api/datasources/' + id).then(() => { 37 | this.getClusters(); 38 | }); 39 | } 40 | 41 | deleteCluster(cluster) { 42 | appEvents.emit('confirm-modal', { 43 | title: 'Delete', 44 | text: 'Are you sure you want to delete this data source? ' + 45 | 'If you need to undeploy the collectors, then do that before deleting the data source.', 46 | yesText: "Delete", 47 | icon: "fa-trash", 48 | onConfirm: () => { 49 | this.confirmDelete(cluster.id); 50 | } 51 | }); 52 | } 53 | 54 | clusterInfo(cluster) { 55 | this.$location.path("plugins/grafana-kubernetes-app/page/cluster-info").search({"cluster": cluster.id}); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/nodeInfo.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class NodeInfoCtrl { 3 | private backendSrv; 4 | private datasourceSrv; 5 | private $q; 6 | private $location; 7 | private alertSrv; 8 | pageReady: boolean; 9 | cluster: any; 10 | clusterDS: any; 11 | node: any; 12 | static templateUrl: string; 13 | /** @ngInject */ 14 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $q: any, $location: any, alertSrv: any); 15 | loadDatasource(id: any): any; 16 | goToNodeDashboard(): void; 17 | conditionStatus(condition: any): { 18 | value: any; 19 | text: string; 20 | }; 21 | isConditionOk(condition: any): any; 22 | conditionLastTransitionTime(condition: any): any; 23 | } 24 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/nodeInfo.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import moment from 'moment'; 4 | 5 | export class NodeInfoCtrl { 6 | pageReady: boolean; 7 | cluster: any; 8 | clusterDS: any; 9 | node: any; 10 | 11 | static templateUrl = 'components/clusters/partials/node_info.html'; 12 | 13 | /** @ngInject */ 14 | constructor($scope, $injector, private backendSrv, private datasourceSrv, private $q, private $location, private alertSrv) { 15 | document.title = 'Grafana Kubernetes App'; 16 | 17 | this.pageReady = false; 18 | this.cluster = {}; 19 | this.clusterDS = {}; 20 | this.node = {}; 21 | 22 | if (!("cluster" in $location.search())) { 23 | alertSrv.set("no cluster specified.", "no cluster specified in url", 'error'); 24 | return; 25 | } else { 26 | let cluster_id = $location.search().cluster; 27 | let node_name = $location.search().node; 28 | 29 | this.loadDatasource(cluster_id).then(() => { 30 | this.clusterDS.getNode(node_name).then(node => { 31 | this.node = node; 32 | this.pageReady = true; 33 | }); 34 | }); 35 | } 36 | } 37 | 38 | loadDatasource(id) { 39 | return this.backendSrv.get('api/datasources/' + id) 40 | .then(ds => { 41 | this.cluster = ds; 42 | return this.datasourceSrv.get(ds.name); 43 | }).then(clusterDS => { 44 | this.clusterDS = clusterDS; 45 | return clusterDS; 46 | }); 47 | } 48 | 49 | goToNodeDashboard() { 50 | this.$location.path("dashboard/db/k8s-node") 51 | .search({ 52 | "var-datasource": this.cluster.jsonData.ds, 53 | "var-cluster": this.cluster.name, 54 | "var-node": slugify(this.node.metadata.name) 55 | }); 56 | } 57 | 58 | conditionStatus(condition) { 59 | var status; 60 | if (condition.type === "Ready") { 61 | status = condition.status === "True"; 62 | } else { 63 | status = condition.status === "False"; 64 | } 65 | 66 | return { 67 | value: status, 68 | text: status ? "Ok" : "Error" 69 | }; 70 | } 71 | 72 | isConditionOk(condition) { 73 | return this.conditionStatus(condition).value; 74 | } 75 | 76 | conditionLastTransitionTime(condition) { 77 | return moment(condition.lastTransitionTime).format('YYYY-MM-DD HH:mm:ss'); 78 | } 79 | } 80 | 81 | function slugify(str) { 82 | var slug = str.replace("@", "at").replace("&", "and").replace(/[.]/g, "_").replace("/\W+/", ""); 83 | return slug; 84 | } 85 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/partials/clusters.html: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 | ...loading 11 |
12 | 13 |
14 |
15 |
16 | 17 |

Looks like you don’t have any clulsters yet.
18 | Add a new cluster 19 |

20 |

Your org does not have any clusters configured. Contact your org admin. 21 |

22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 48 | 49 | 50 |
Name
35 | 36 | {{cluster.name}} Overview 37 | 38 | 40 | 41 | Cluster Config 42 | 43 |    44 | 45 | 46 | 47 |
51 |
52 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/partials/node_info.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
15 |

Addresses

16 |
17 | 18 | {{addr.type}}: {{addr.address}} 19 | 20 |
21 |
22 |
23 |

Capacity

24 |
25 | 26 | {{k}}: {{v}} 27 | 28 |
29 |
30 |
31 |

Labels

32 |
33 | 34 | {{k}}: {{v}} 35 | 36 |
37 |
38 |
39 | 40 |
41 |

Conditions

42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 59 | 60 | 61 | 62 | 63 |
StatusTypeMessageLast Change
51 | 56 | 57 | {{ctrl.conditionStatus(condition).text}} 58 | {{condition.type}}{{condition.message}}{{ctrl.conditionLastTransitionTime(condition)}}
64 |
65 |
66 | 67 |

Info

68 | 69 | 70 | 71 | 72 | 73 |
{{k}}{{v}}
74 |
75 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/podInfo.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class PodInfoCtrl { 3 | private backendSrv; 4 | private datasourceSrv; 5 | private $q; 6 | private $location; 7 | private alertSrv; 8 | pageReady: boolean; 9 | pod: any; 10 | cluster_id: any; 11 | clusterDS: any; 12 | datasource: any; 13 | static templateUrl: string; 14 | /** @ngInject */ 15 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $q: any, $location: any, alertSrv: any); 16 | loadDatasource(id: any): any; 17 | conditionStatus(condition: any): { 18 | value: any; 19 | text: string; 20 | }; 21 | goToPodDashboard(pod: any): void; 22 | isConditionOk(condition: any): any; 23 | formatTime(time: any): any; 24 | } 25 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/clusters/podInfo.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import moment from 'moment'; 4 | 5 | function slugify(str) { 6 | var slug = str.replace("@", "at").replace("&", "and").replace(/[.]/g, "_").replace("/\W+/", ""); 7 | return slug; 8 | } 9 | 10 | export class PodInfoCtrl { 11 | pageReady: boolean; 12 | pod: any; 13 | cluster_id: any; 14 | clusterDS: any; 15 | datasource: any; 16 | 17 | static templateUrl = 'components/clusters/partials/pod_info.html'; 18 | 19 | /** @ngInject */ 20 | constructor($scope, $injector, private backendSrv, private datasourceSrv, private $q, private $location, private alertSrv) { 21 | document.title = 'Grafana Kubernetes App'; 22 | 23 | this.pageReady = false; 24 | this.pod = {}; 25 | if (!("cluster" in $location.search())) { 26 | alertSrv.set("no cluster specified.", "no cluster specified in url", 'error'); 27 | return; 28 | } else { 29 | this.cluster_id = $location.search().cluster; 30 | let pod_name = $location.search().pod; 31 | 32 | this.loadDatasource(this.cluster_id).then(() => { 33 | this.clusterDS.getPod(pod_name).then(pod => { 34 | this.pod = pod; 35 | this.pageReady = true; 36 | }); 37 | }); 38 | } 39 | } 40 | 41 | loadDatasource(id) { 42 | return this.backendSrv.get('api/datasources/' + id) 43 | .then(ds => { 44 | this.datasource = ds.jsonData.ds; 45 | return this.datasourceSrv.get(ds.name); 46 | }).then(clusterDS => { 47 | this.clusterDS = clusterDS; 48 | return clusterDS; 49 | }); 50 | } 51 | 52 | conditionStatus(condition) { 53 | var status; 54 | if (condition.type === "Ready") { 55 | status = condition.status === "True"; 56 | } else { 57 | status = condition.status === "False"; 58 | } 59 | 60 | return { 61 | value: status, 62 | text: status ? "Ok" : "Error" 63 | }; 64 | } 65 | 66 | goToPodDashboard(pod) { 67 | this.$location.path("dashboard/db/k8s-container") 68 | .search({ 69 | "var-datasource": this.datasource, 70 | "var-cluster": this.clusterDS.name, 71 | "var-node": slugify(pod.spec.nodeName), 72 | "var-namespace": pod.metadata.namespace, 73 | "var-pod": pod.metadata.name 74 | }); 75 | } 76 | 77 | isConditionOk(condition) { 78 | return this.conditionStatus(condition).value; 79 | } 80 | 81 | formatTime(time) { 82 | return moment(time).format('YYYY-MM-DD HH:mm:ss'); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/config/config.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class KubernetesConfigCtrl { 3 | private $q; 4 | static templateUrl: string; 5 | enabled: boolean; 6 | appEditCtrl: any; 7 | appModel: any; 8 | /** @ngInject */ 9 | constructor($scope: any, $injector: any, $q: any); 10 | postUpdate(): any; 11 | } 12 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/config/config.html: -------------------------------------------------------------------------------- 1 |

Kubernetes App

2 | This app integrates the data collected from Kubelet, Kube-State Metrics, and Node Exporter with data available via the Kubernetes API. 3 | 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/config/config.js: -------------------------------------------------------------------------------- 1 | /// 2 | System.register([], function(exports_1) { 3 | var KubernetesConfigCtrl; 4 | return { 5 | setters:[], 6 | execute: function() { 7 | KubernetesConfigCtrl = (function () { 8 | /** @ngInject */ 9 | function KubernetesConfigCtrl($scope, $injector, $q) { 10 | this.$q = $q; 11 | this.enabled = false; 12 | this.appEditCtrl.setPostUpdateHook(this.postUpdate.bind(this)); 13 | } 14 | KubernetesConfigCtrl.prototype.postUpdate = function () { 15 | var _this = this; 16 | if (!this.appModel.enabled) { 17 | return this.$q.resolve(); 18 | } 19 | return this.appEditCtrl.importDashboards().then(function () { 20 | _this.enabled = true; 21 | return { 22 | url: "plugins/grafana-kubernetes-app/page/clusters", 23 | message: "Kubernetes App enabled!" 24 | }; 25 | }); 26 | }; 27 | KubernetesConfigCtrl.templateUrl = 'components/config/config.html'; 28 | return KubernetesConfigCtrl; 29 | })(); 30 | exports_1("KubernetesConfigCtrl", KubernetesConfigCtrl); 31 | } 32 | } 33 | }); 34 | //# sourceMappingURL=config.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/config/config.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"config.js","sourceRoot":"","sources":["config.ts"],"names":["KubernetesConfigCtrl","KubernetesConfigCtrl.constructor","KubernetesConfigCtrl.postUpdate"],"mappings":"AAAA,uFAAuF;;;;;;YAEvF;gBAMEA,gBAAgBA;gBAChBA,8BAAYA,MAAMA,EAAEA,SAASA,EAAUA,EAAEA;oBAAFC,OAAEA,GAAFA,EAAEA,CAAAA;oBACvCA,IAAIA,CAACA,OAAOA,GAAGA,KAAKA,CAACA;oBACrBA,IAAIA,CAACA,WAAWA,CAACA,iBAAiBA,CAACA,IAAIA,CAACA,UAAUA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,CAACA;gBACjEA,CAACA;gBAEDD,yCAAUA,GAAVA;oBAAAE,iBAWCA;oBAVCA,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,QAAQA,CAACA,OAAOA,CAACA,CAACA,CAACA;wBAC3BA,MAAMA,CAACA,IAAIA,CAACA,EAAEA,CAACA,OAAOA,EAAEA,CAACA;oBAC3BA,CAACA;oBACDA,MAAMA,CAACA,IAAIA,CAACA,WAAWA,CAACA,gBAAgBA,EAAEA,CAACA,IAAIA,CAACA;wBAC9CA,KAAIA,CAACA,OAAOA,GAAGA,IAAIA,CAACA;wBACpBA,MAAMA,CAACA;4BACLA,GAAGA,EAAEA,8CAA8CA;4BACnDA,OAAOA,EAAEA,yBAAyBA;yBACnCA,CAACA;oBACJA,CAACA,CAACA,CAACA;gBACLA,CAACA;gBAtBMF,gCAAWA,GAAGA,+BAA+BA,CAACA;gBAuBvDA,2BAACA;YAADA,CAACA,AAxBD,IAwBC;YAxBD,uDAwBC,CAAA"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/components/config/config.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | export class KubernetesConfigCtrl { 4 | static templateUrl = 'components/config/config.html'; 5 | enabled: boolean; 6 | appEditCtrl: any; 7 | appModel: any; 8 | 9 | /** @ngInject */ 10 | constructor($scope, $injector, private $q) { 11 | this.enabled = false; 12 | this.appEditCtrl.setPostUpdateHook(this.postUpdate.bind(this)); 13 | } 14 | 15 | postUpdate() { 16 | if (!this.appModel.enabled) { 17 | return this.$q.resolve(); 18 | } 19 | return this.appEditCtrl.importDashboards().then(() => { 20 | this.enabled = true; 21 | return { 22 | url: "plugins/grafana-kubernetes-app/page/clusters", 23 | message: "Kubernetes App enabled!" 24 | }; 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/css/dark.css: -------------------------------------------------------------------------------- 1 | tr.dashlist-item:hover { 2 | background-color: #333; 3 | cursor: pointer; 4 | } 5 | 6 | /* pod nav panel */ 7 | .podnav-wrapper { 8 | display: flex; 9 | flex-direction: row; 10 | justify-content: space-between; 11 | } 12 | 13 | .podnav-tags-wrapper { 14 | width: 60%; 15 | } 16 | 17 | .chosen-tags-container { 18 | display: block; 19 | } 20 | 21 | .chosen-tags-container .label-tag { 22 | line-height: 20px; 23 | margin-bottom: 10px; 24 | } 25 | 26 | .podnav-tags { 27 | display: flex; 28 | flex-direction: column; 29 | flex-wrap: wrap; 30 | align-content: flex-start; 31 | max-height: 300px; 32 | overflow: auto; 33 | } 34 | 35 | .podnav-pods { 36 | width: 40%; 37 | display: flex; 38 | flex-direction: column; 39 | } 40 | 41 | .podnav-results { 42 | display: flex; 43 | flex-direction: column; 44 | overflow: auto; 45 | max-height: 300px; 46 | } 47 | 48 | .podnav-result { 49 | display: block; 50 | padding: 3px 10px; 51 | background-color: #292929; 52 | margin-bottom: 4px; 53 | } 54 | 55 | .podnav-result:hover { 56 | background-color: #333; 57 | cursor: pointer; 58 | } 59 | 60 | .podnav-result button { 61 | margin-right: 15px; 62 | } 63 | 64 | /* plugin config */ 65 | 66 | .pluginconfig-message { 67 | margin: 20px; 68 | } 69 | 70 | .k8s-icon-success { 71 | color: #10a345; 72 | font-size: 24px; 73 | text-decoration: none; 74 | vertical-align: sub; 75 | } 76 | 77 | /* cluster info */ 78 | .main-dash-links { 79 | margin-bottom: 40px; 80 | } 81 | .card-item--main-dash-link { 82 | padding: 20px; 83 | } 84 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/css/light.css: -------------------------------------------------------------------------------- 1 | tr.dashlist-item:hover { 2 | background-color: #ECECEC; 3 | cursor: pointer; 4 | } 5 | 6 | /* pod nav panel */ 7 | .podnav-wrapper { 8 | display: flex; 9 | flex-direction: row; 10 | justify-content: space-between; 11 | } 12 | 13 | .podnav-tags-wrapper { 14 | width: 60%; 15 | } 16 | 17 | .chosen-tags-container { 18 | display: block; 19 | } 20 | 21 | .chosen-tags-container .label-tag { 22 | line-height: 20px; 23 | margin-bottom: 10px; 24 | } 25 | 26 | .podnav-tags { 27 | display: flex; 28 | flex-direction: column; 29 | flex-wrap: wrap; 30 | align-content: flex-start; 31 | max-height: 300px; 32 | overflow: auto; 33 | } 34 | 35 | .podnav-pods { 36 | width: 40%; 37 | display: flex; 38 | flex-direction: column; 39 | } 40 | 41 | .podnav-results { 42 | display: flex; 43 | flex-direction: column; 44 | overflow: auto; 45 | max-height: 300px; 46 | } 47 | 48 | .podnav-result { 49 | display: block; 50 | padding: 3px 10px; 51 | background-color: #f4f5f8; 52 | margin-bottom: 4px; 53 | } 54 | 55 | .podnav-result:hover { 56 | background-color: #ECECEC; 57 | cursor: pointer; 58 | } 59 | 60 | .podnav-result button { 61 | margin-right: 15px; 62 | } 63 | 64 | /* plugin config */ 65 | 66 | .pluginconfig-message { 67 | margin: 20px; 68 | } 69 | 70 | .k8s-icon-success { 71 | color: #10a345; 72 | font-size: 24px; 73 | text-decoration: none; 74 | vertical-align: sub; 75 | } 76 | 77 | /* cluster info */ 78 | .main-dash-links { 79 | margin-bottom: 40px; 80 | } 81 | .card-item--main-dash-link { 82 | padding: 20px; 83 | } 84 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/datasource.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export declare class K8sDatasource { 3 | private backendSrv; 4 | private templateSrv; 5 | private $q; 6 | id: number; 7 | name: string; 8 | url: string; 9 | type: string; 10 | ds: string; 11 | static baseApiUrl: string; 12 | constructor(instanceSettings: any, backendSrv: any, templateSrv: any, $q: any); 13 | testDatasource(): any; 14 | _get(apiResource: any): any; 15 | getNodes(): any; 16 | getNode(name: any): any; 17 | getNamespaces(): any; 18 | getComponentStatuses(): any; 19 | getDaemonSets(namespace: any): any; 20 | getReplicationControllers(namespace: any): any; 21 | getDeployments(namespace: any): any; 22 | getPods(namespace: any): any; 23 | getPodsByLabel(namespace: any, labels: any): any; 24 | getPod(name: any): any; 25 | getPodsByName(names: any): any; 26 | query(options: any): void; 27 | annotationQuery(options: any): void; 28 | metricFindQuery(query: string): any; 29 | } 30 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/module.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { K8sDatasource } from './datasource'; 3 | import { K8sQueryCtrl } from './query_ctrl'; 4 | declare class K8sConfigCtrl { 5 | static templateUrl: string; 6 | } 7 | export { K8sDatasource as Datasource, K8sQueryCtrl as QueryCtrl, K8sConfigCtrl as ConfigCtrl }; 8 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/module.js: -------------------------------------------------------------------------------- 1 | /// 2 | System.register(['./datasource', './query_ctrl'], function(exports_1) { 3 | var datasource_1, query_ctrl_1; 4 | var K8sConfigCtrl; 5 | return { 6 | setters:[ 7 | function (datasource_1_1) { 8 | datasource_1 = datasource_1_1; 9 | }, 10 | function (query_ctrl_1_1) { 11 | query_ctrl_1 = query_ctrl_1_1; 12 | }], 13 | execute: function() { 14 | K8sConfigCtrl = (function () { 15 | function K8sConfigCtrl() { 16 | } 17 | K8sConfigCtrl.templateUrl = 'datasource/partials/config.html'; 18 | return K8sConfigCtrl; 19 | })(); 20 | exports_1("Datasource", datasource_1.K8sDatasource); 21 | exports_1("QueryCtrl", query_ctrl_1.K8sQueryCtrl); 22 | exports_1("ConfigCtrl", K8sConfigCtrl); 23 | } 24 | } 25 | }); 26 | //# sourceMappingURL=module.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":["K8sConfigCtrl","K8sConfigCtrl.constructor"],"mappings":"AAAA,oFAAoF;;;;;;;;;;;;;YAKpF;gBAAAA;gBAEAC,CAACA;gBADQD,yBAAWA,GAAGA,iCAAiCA,CAACA;gBACzDA,oBAACA;YAADA,CAACA,AAFD,IAEC;YAGkB,mDAAU;YACX,iDAAS;YACR,sCAAU"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {K8sDatasource} from './datasource'; 4 | import {K8sQueryCtrl} from './query_ctrl'; 5 | 6 | class K8sConfigCtrl { 7 | static templateUrl = 'datasource/partials/config.html'; 8 | } 9 | 10 | export { 11 | K8sDatasource as Datasource, 12 | K8sQueryCtrl as QueryCtrl, 13 | K8sConfigCtrl as ConfigCtrl 14 | }; -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/partials/config.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/partials/query.editor.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
-------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Kubernetes", 3 | "id": "grafana-kubernetes-datasource", 4 | "type": "datasource", 5 | 6 | "staticRoot": ".", 7 | 8 | "partials": { 9 | "config": "public/app/plugins/grafana-kubernetes-app/datasource/partials/config.html" 10 | }, 11 | 12 | "metrics": true, 13 | "annotations": false, 14 | 15 | "info": { 16 | "description": "Kubernetes datasource", 17 | "author": { 18 | "name": "Grafana Labs", 19 | "url": "https://grafana.com/" 20 | }, 21 | "logos": { 22 | "small": "img/logo.svg", 23 | "large": "img/logo.svg" 24 | }, 25 | "links": [ 26 | {"name": "GitHub", "url": "https://github.com/grafana/kubernetes-app"}, 27 | {"name": "License", "url": "https://github.com/grafana/kubernetes-app/blob/master/LICENSE"} 28 | ], 29 | "version": "0.0.1", 30 | "updated": "2018-01-18" 31 | }, 32 | 33 | "dependencies": { 34 | "grafanaVersion": "5.x.x", 35 | "plugins": [ ] 36 | } 37 | } -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/query_ctrl.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { QueryCtrl } from 'app/plugins/sdk'; 3 | export declare class K8sQueryCtrl extends QueryCtrl { 4 | private templateSrv; 5 | static templateUrl: string; 6 | defaults: {}; 7 | /** @ngInject **/ 8 | constructor($scope: any, $injector: any, templateSrv: any); 9 | getOptions(query: any): any; 10 | onChangeInternal(): void; 11 | } 12 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/query_ctrl.js: -------------------------------------------------------------------------------- 1 | System.register(['lodash', 'app/plugins/sdk'], function(exports_1) { 2 | var __extends = (this && this.__extends) || function (d, b) { 3 | for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; 4 | function __() { this.constructor = d; } 5 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 6 | }; 7 | var lodash_1, sdk_1; 8 | var K8sQueryCtrl; 9 | return { 10 | setters:[ 11 | function (lodash_1_1) { 12 | lodash_1 = lodash_1_1; 13 | }, 14 | function (sdk_1_1) { 15 | sdk_1 = sdk_1_1; 16 | }], 17 | execute: function() { 18 | K8sQueryCtrl = (function (_super) { 19 | __extends(K8sQueryCtrl, _super); 20 | /** @ngInject **/ 21 | function K8sQueryCtrl($scope, $injector, templateSrv) { 22 | _super.call(this, $scope, $injector); 23 | this.templateSrv = templateSrv; 24 | this.defaults = {}; 25 | lodash_1.default.defaultsDeep(this.target, this.defaults); 26 | this.target.target = this.target.target || ''; 27 | this.target.type = this.target.type || 'timeserie'; 28 | } 29 | K8sQueryCtrl.prototype.getOptions = function (query) { 30 | return this.datasource.metricFindQuery(''); 31 | }; 32 | K8sQueryCtrl.prototype.onChangeInternal = function () { 33 | this.panelCtrl.refresh(); // Asks the panel to refresh data. 34 | }; 35 | K8sQueryCtrl.templateUrl = 'datasource/partials/query.editor.html'; 36 | return K8sQueryCtrl; 37 | })(sdk_1.QueryCtrl); 38 | exports_1("K8sQueryCtrl", K8sQueryCtrl); 39 | } 40 | } 41 | }); 42 | //# sourceMappingURL=query_ctrl.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/query_ctrl.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"query_ctrl.js","sourceRoot":"","sources":["query_ctrl.ts"],"names":["K8sQueryCtrl","K8sQueryCtrl.constructor","K8sQueryCtrl.getOptions","K8sQueryCtrl.onChangeInternal"],"mappings":";;;;;;;;;;;;;;;;;YAIA;gBAAkCA,gCAASA;gBAMzCA,iBAAiBA;gBACjBA,sBAAYA,MAAMA,EAAEA,SAASA,EAAUA,WAAWA;oBAChDC,kBAAMA,MAAMA,EAAEA,SAASA,CAACA,CAACA;oBADYA,gBAAWA,GAAXA,WAAWA,CAAAA;oBAJlDA,aAAQA,GAAGA,EACVA,CAACA;oBAMAA,gBAACA,CAACA,YAAYA,CAACA,IAAIA,CAACA,MAAMA,EAAEA,IAAIA,CAACA,QAAQA,CAACA,CAACA;oBAE3CA,IAAIA,CAACA,MAAMA,CAACA,MAAMA,GAAGA,IAAIA,CAACA,MAAMA,CAACA,MAAMA,IAAIA,EAAEA,CAACA;oBAC9CA,IAAIA,CAACA,MAAMA,CAACA,IAAIA,GAAGA,IAAIA,CAACA,MAAMA,CAACA,IAAIA,IAAIA,WAAWA,CAACA;gBACrDA,CAACA;gBAEDD,iCAAUA,GAAVA,UAAWA,KAAKA;oBACdE,MAAMA,CAACA,IAAIA,CAACA,UAAUA,CAACA,eAAeA,CAACA,EAAEA,CAACA,CAACA;gBAC7CA,CAACA;gBAEDF,uCAAgBA,GAAhBA;oBACEG,IAAIA,CAACA,SAASA,CAACA,OAAOA,EAAEA,CAACA,CAACA,kCAAkCA;gBAC9DA,CAACA;gBArBMH,wBAAWA,GAAGA,uCAAuCA,CAACA;gBAsB/DA,mBAACA;YAADA,CAACA,AAvBD,EAAkC,eAAS,EAuB1C;YAvBD,uCAuBC,CAAA"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/datasource/query_ctrl.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import _ from 'lodash'; 3 | import {QueryCtrl} from 'app/plugins/sdk'; 4 | 5 | export class K8sQueryCtrl extends QueryCtrl { 6 | static templateUrl = 'datasource/partials/query.editor.html'; 7 | 8 | defaults = { 9 | }; 10 | 11 | /** @ngInject **/ 12 | constructor($scope, $injector, private templateSrv) { 13 | super($scope, $injector); 14 | 15 | _.defaultsDeep(this.target, this.defaults); 16 | 17 | this.target.target = this.target.target || ''; 18 | this.target.type = this.target.type || 'timeserie'; 19 | } 20 | 21 | getOptions(query) { 22 | return this.datasource.metricFindQuery(''); 23 | } 24 | 25 | onChangeInternal() { 26 | this.panelCtrl.refresh(); // Asks the panel to refresh data. 27 | } 28 | } -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/app-menu-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/app-menu-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/cluster-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/cluster-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/container-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/container-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/namespace-details-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/namespace-details-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/node-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/node-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/overview-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/overview-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/pod-details-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/img/pod-details-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/module.d.ts: -------------------------------------------------------------------------------- 1 | import { KubernetesConfigCtrl } from './components/config/config'; 2 | import { ClustersCtrl } from './components/clusters/clusters'; 3 | import { ClusterConfigCtrl } from './components/clusters/clusterConfig'; 4 | import { ClusterInfoCtrl } from './components/clusters/clusterInfo'; 5 | import { ClusterWorkloadsCtrl } from './components/clusters/clusterWorkloads'; 6 | import { NodeInfoCtrl } from './components/clusters/nodeInfo'; 7 | import { PodInfoCtrl } from './components/clusters/podInfo'; 8 | export { KubernetesConfigCtrl as ConfigCtrl, ClustersCtrl, ClusterConfigCtrl, ClusterInfoCtrl, ClusterWorkloadsCtrl, NodeInfoCtrl, PodInfoCtrl }; 9 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/module.js: -------------------------------------------------------------------------------- 1 | System.register(['./components/config/config', './components/clusters/clusters', './components/clusters/clusterConfig', './components/clusters/clusterInfo', './components/clusters/clusterWorkloads', './components/clusters/nodeInfo', './components/clusters/podInfo', 'app/plugins/sdk'], function(exports_1) { 2 | var config_1, clusters_1, clusterConfig_1, clusterInfo_1, clusterWorkloads_1, nodeInfo_1, podInfo_1, sdk_1; 3 | return { 4 | setters:[ 5 | function (config_1_1) { 6 | config_1 = config_1_1; 7 | }, 8 | function (clusters_1_1) { 9 | clusters_1 = clusters_1_1; 10 | }, 11 | function (clusterConfig_1_1) { 12 | clusterConfig_1 = clusterConfig_1_1; 13 | }, 14 | function (clusterInfo_1_1) { 15 | clusterInfo_1 = clusterInfo_1_1; 16 | }, 17 | function (clusterWorkloads_1_1) { 18 | clusterWorkloads_1 = clusterWorkloads_1_1; 19 | }, 20 | function (nodeInfo_1_1) { 21 | nodeInfo_1 = nodeInfo_1_1; 22 | }, 23 | function (podInfo_1_1) { 24 | podInfo_1 = podInfo_1_1; 25 | }, 26 | function (sdk_1_1) { 27 | sdk_1 = sdk_1_1; 28 | }], 29 | execute: function() { 30 | sdk_1.loadPluginCss({ 31 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 32 | light: 'plugins/grafana-kubernetes-app/css/light.css' 33 | }); 34 | exports_1("ConfigCtrl", config_1.KubernetesConfigCtrl); 35 | exports_1("ClustersCtrl", clusters_1.ClustersCtrl); 36 | exports_1("ClusterConfigCtrl", clusterConfig_1.ClusterConfigCtrl); 37 | exports_1("ClusterInfoCtrl", clusterInfo_1.ClusterInfoCtrl); 38 | exports_1("ClusterWorkloadsCtrl", clusterWorkloads_1.ClusterWorkloadsCtrl); 39 | exports_1("NodeInfoCtrl", nodeInfo_1.NodeInfoCtrl); 40 | exports_1("PodInfoCtrl", podInfo_1.PodInfoCtrl); 41 | } 42 | } 43 | }); 44 | //# sourceMappingURL=module.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;YASA,mBAAa,CAAC;gBACZ,IAAI,EAAE,6CAA6C;gBACnD,KAAK,EAAE,8CAA8C;aACtD,CAAC,CAAC;YAGuB,sDAAU;YAClC,kDAAY;YACZ,iEAAiB;YACjB,2DAAe;YACf,0EAAoB;YACpB,kDAAY;YACZ,+CAAW"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/module.ts: -------------------------------------------------------------------------------- 1 | import {KubernetesConfigCtrl} from './components/config/config'; 2 | import {ClustersCtrl} from './components/clusters/clusters'; 3 | import {ClusterConfigCtrl} from './components/clusters/clusterConfig'; 4 | import {ClusterInfoCtrl} from './components/clusters/clusterInfo'; 5 | import {ClusterWorkloadsCtrl} from './components/clusters/clusterWorkloads'; 6 | import {NodeInfoCtrl} from './components/clusters/nodeInfo'; 7 | import {PodInfoCtrl} from './components/clusters/podInfo'; 8 | import {loadPluginCss} from 'app/plugins/sdk'; 9 | 10 | loadPluginCss({ 11 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 12 | light: 'plugins/grafana-kubernetes-app/css/light.css' 13 | }); 14 | 15 | export { 16 | KubernetesConfigCtrl as ConfigCtrl, 17 | ClustersCtrl, 18 | ClusterConfigCtrl, 19 | ClusterInfoCtrl, 20 | ClusterWorkloadsCtrl, 21 | NodeInfoCtrl, 22 | PodInfoCtrl 23 | }; 24 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/module.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { NodeDataCtrl } from './nodeData'; 3 | export { NodeDataCtrl as PanelCtrl }; 4 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/module.js: -------------------------------------------------------------------------------- 1 | /// 2 | System.register(['./nodeData', 'app/plugins/sdk'], function(exports_1) { 3 | var nodeData_1, sdk_1; 4 | return { 5 | setters:[ 6 | function (nodeData_1_1) { 7 | nodeData_1 = nodeData_1_1; 8 | }, 9 | function (sdk_1_1) { 10 | sdk_1 = sdk_1_1; 11 | }], 12 | execute: function() { 13 | sdk_1.loadPluginCss({ 14 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 15 | light: 'plugins/grafana-kubernetes-app/css/light.css' 16 | }); 17 | exports_1("PanelCtrl", nodeData_1.NodeDataCtrl); 18 | } 19 | } 20 | }); 21 | //# sourceMappingURL=module.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":[],"mappings":"AAAA,uFAAuF;;;;;;;;;;;;YAKvF,mBAAa,CAAC;gBACZ,IAAI,EAAE,6CAA6C;gBACnD,KAAK,EAAE,8CAA8C;aACtD,CAAC,CAAC;YAGe,+CAAS"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {NodeDataCtrl} from './nodeData'; 4 | import {loadPluginCss} from 'app/plugins/sdk'; 5 | 6 | loadPluginCss({ 7 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 8 | light: 'plugins/grafana-kubernetes-app/css/light.css' 9 | }); 10 | 11 | export { 12 | NodeDataCtrl as PanelCtrl 13 | }; 14 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/nodeData.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { PanelCtrl } from 'app/plugins/sdk'; 3 | import NodeStatsDatasource from './nodeStats'; 4 | export declare class NodeDataCtrl extends PanelCtrl { 5 | private backendSrv; 6 | private datasourceSrv; 7 | private $location; 8 | private alertSrv; 9 | private timeSrv; 10 | private variableSrv; 11 | templateVariables: any; 12 | nodeStatsDatasource: NodeStatsDatasource; 13 | pageReady: boolean; 14 | cluster: any; 15 | clusterDS: any; 16 | node: any; 17 | isInListMode: boolean; 18 | nodes: any[]; 19 | static templateUrl: string; 20 | static scrollable: boolean; 21 | /** @ngInject */ 22 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $location: any, alertSrv: any, timeSrv: any, variableSrv: any); 23 | loadCluster(): void; 24 | getNodeHealth(node: any): { 25 | text: string; 26 | iconClass: string; 27 | stateClass: string; 28 | message: any; 29 | }; 30 | getHealthState(health: any, message: any): { 31 | text: string; 32 | iconClass: string; 33 | stateClass: string; 34 | message: any; 35 | }; 36 | refresh(): void; 37 | loadDatasource(id: any): any; 38 | goToNodeDashboard(node: any): void; 39 | conditionStatus(condition: any): { 40 | value: any; 41 | text: string; 42 | }; 43 | isConditionOk(condition: any): any; 44 | conditionLastTransitionTime(condition: any): any; 45 | } 46 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/nodeStats.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | export default class NodeStatsDatasource { 3 | private datasourceSrv; 4 | private timeSrv; 5 | constructor(datasourceSrv: any, timeSrv: any); 6 | issuePrometheusQuery(prometheusDS: any, query: any): any; 7 | getNodeStats(cluster_id: any, prometheusDS: any): any; 8 | updateNodeWithStats(node: any, nodeStats: any): any; 9 | } 10 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/nodeData/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "panel", 3 | "name": "Kubernetes Node Info", 4 | "id": "prometheus-kubernetes-nodeinfo-panel" 5 | } 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/module.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { PodNavCtrl } from './podNav'; 3 | export { PodNavCtrl as PanelCtrl }; 4 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/module.js: -------------------------------------------------------------------------------- 1 | /// 2 | System.register(['./podNav', 'app/plugins/sdk'], function(exports_1) { 3 | var podNav_1, sdk_1; 4 | return { 5 | setters:[ 6 | function (podNav_1_1) { 7 | podNav_1 = podNav_1_1; 8 | }, 9 | function (sdk_1_1) { 10 | sdk_1 = sdk_1_1; 11 | }], 12 | execute: function() { 13 | sdk_1.loadPluginCss({ 14 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 15 | light: 'plugins/grafana-kubernetes-app/css/light.css' 16 | }); 17 | exports_1("PanelCtrl", podNav_1.PodNavCtrl); 18 | } 19 | } 20 | }); 21 | //# sourceMappingURL=module.js.map -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/module.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"module.js","sourceRoot":"","sources":["module.ts"],"names":[],"mappings":"AAAA,uFAAuF;;;;;;;;;;;;YAKvF,mBAAa,CAAC;gBACZ,IAAI,EAAE,6CAA6C;gBACnD,KAAK,EAAE,8CAA8C;aACtD,CAAC,CAAC;YAGa,2CAAS"} -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {PodNavCtrl} from './podNav'; 4 | import {loadPluginCss} from 'app/plugins/sdk'; 5 | 6 | loadPluginCss({ 7 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 8 | light: 'plugins/grafana-kubernetes-app/css/light.css' 9 | }); 10 | 11 | export { 12 | PodNavCtrl as PanelCtrl 13 | }; 14 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/partials/pod_nav.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Filter Pods By Kubernetes Tag

4 |
5 | 6 | 7 | {{tag}}={{value}} 8 | 9 | 10 |
11 |
12 |
13 |
14 | 17 |
18 | 21 |
22 |
23 |
24 |
25 |
26 |
27 |

Filter by Pod Name

28 |
29 | 30 | 31 | {{podTag}} 32 | 33 | 34 |
35 |
36 | 37 | 38 | {{pod}} 39 | 40 |
41 |
42 |
43 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "panel", 3 | "name": "Kubernetes Pod Nav", 4 | "id": "prometheus-kubernetes-podnav-panel" 5 | } 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/dist/panels/podNav/podNav.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { PanelCtrl } from 'app/plugins/sdk'; 3 | export declare class PodNavCtrl extends PanelCtrl { 4 | private backendSrv; 5 | private datasourceSrv; 6 | private $location; 7 | private alertSrv; 8 | private variableSrv; 9 | private $q; 10 | templateVariables: any; 11 | namespace: string; 12 | currentTags: any; 13 | currentPods: any[]; 14 | selectedPods: any; 15 | chosenTags: any; 16 | clusterName: string; 17 | clusterDS: any; 18 | static templateUrl: string; 19 | constructor($scope: any, $injector: any, backendSrv: any, datasourceSrv: any, $location: any, alertSrv: any, variableSrv: any, $q: any); 20 | refresh(): void; 21 | needsRefresh(): boolean; 22 | loadTags(): void; 23 | setDefaults(): void; 24 | getPods(): any; 25 | parseTagsFromPods(pods: any): void; 26 | onTagSelect(): void; 27 | getPodsByLabel(): any; 28 | updateTemplateVariableWithPods(): void; 29 | removeEmptyTags(): void; 30 | getCluster(): any; 31 | removeTag(tag: any): void; 32 | selectPod(podName: any): void; 33 | removePodTag(podName: any): void; 34 | } 35 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/grafana/kubernetes-app.git" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "bugs": { 16 | "url": "https://github.com/grafana/kubernetes-app/issues" 17 | }, 18 | "devDependencies": { 19 | "grafana-sdk-mocks": "grafana/grafana-sdk-mocks", 20 | "grunt": "^1.0.1", 21 | "grunt-contrib-clean": "^1.1.0", 22 | "grunt-contrib-copy": "^1.0.0", 23 | "grunt-contrib-watch": "^1.0.0", 24 | "grunt-typescript": "^0.8.0", 25 | "grunt-sass": "^1.1.0", 26 | "grunt-systemjs-builder": "^0.2.5", 27 | "load-grunt-tasks": "~3.2.0", 28 | "typescript": "~2.6.2" 29 | }, 30 | "dependencies": { 31 | "lodash": "^4.17.4" 32 | }, 33 | "homepage": "https://grafana.com/" 34 | } 35 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/clusters/clusters.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import _ from 'lodash'; 4 | import appEvents from 'app/core/app_events'; 5 | 6 | export class ClustersCtrl { 7 | cluster: any; 8 | pageReady: boolean; 9 | datasources: [any]; 10 | clusters: {}; 11 | isOrgEditor: boolean; 12 | 13 | static templateUrl = 'components/clusters/partials/clusters.html'; 14 | 15 | /** @ngInject */ 16 | constructor($scope, $injector, private backendSrv, private contextSrv, private $location) { 17 | var self = this; 18 | this.isOrgEditor = contextSrv.hasRole('Editor') || contextSrv.hasRole('Admin'); 19 | document.title = 'Grafana Kubernetes App'; 20 | this.clusters = {}; 21 | this.pageReady = false; 22 | this.getClusters().then(() => { 23 | self.pageReady = true; 24 | }); 25 | } 26 | 27 | getClusters() { 28 | var self = this; 29 | return this.backendSrv.get('/api/datasources') 30 | .then((result) => { 31 | self.clusters = _.filter(result, {"type": "grafana-kubernetes-datasource"}); 32 | }); 33 | } 34 | 35 | confirmDelete(id) { 36 | this.backendSrv.delete('/api/datasources/' + id).then(() => { 37 | this.getClusters(); 38 | }); 39 | } 40 | 41 | deleteCluster(cluster) { 42 | appEvents.emit('confirm-modal', { 43 | title: 'Delete', 44 | text: 'Are you sure you want to delete this data source? ' + 45 | 'If you need to undeploy the collectors, then do that before deleting the data source.', 46 | yesText: "Delete", 47 | icon: "fa-trash", 48 | onConfirm: () => { 49 | this.confirmDelete(cluster.id); 50 | } 51 | }); 52 | } 53 | 54 | clusterInfo(cluster) { 55 | this.$location.path("plugins/grafana-kubernetes-app/page/cluster-info").search({"cluster": cluster.id}); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/clusters/nodeInfo.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import moment from 'moment'; 4 | 5 | export class NodeInfoCtrl { 6 | pageReady: boolean; 7 | cluster: any; 8 | clusterDS: any; 9 | node: any; 10 | 11 | static templateUrl = 'components/clusters/partials/node_info.html'; 12 | 13 | /** @ngInject */ 14 | constructor($scope, $injector, private backendSrv, private datasourceSrv, private $q, private $location, private alertSrv) { 15 | document.title = 'Grafana Kubernetes App'; 16 | 17 | this.pageReady = false; 18 | this.cluster = {}; 19 | this.clusterDS = {}; 20 | this.node = {}; 21 | 22 | if (!("cluster" in $location.search())) { 23 | alertSrv.set("no cluster specified.", "no cluster specified in url", 'error'); 24 | return; 25 | } else { 26 | let cluster_id = $location.search().cluster; 27 | let node_name = $location.search().node; 28 | 29 | this.loadDatasource(cluster_id).then(() => { 30 | this.clusterDS.getNode(node_name).then(node => { 31 | this.node = node; 32 | this.pageReady = true; 33 | }); 34 | }); 35 | } 36 | } 37 | 38 | loadDatasource(id) { 39 | return this.backendSrv.get('api/datasources/' + id) 40 | .then(ds => { 41 | this.cluster = ds; 42 | return this.datasourceSrv.get(ds.name); 43 | }).then(clusterDS => { 44 | this.clusterDS = clusterDS; 45 | return clusterDS; 46 | }); 47 | } 48 | 49 | goToNodeDashboard() { 50 | this.$location.path("dashboard/db/k8s-node") 51 | .search({ 52 | "var-datasource": this.cluster.jsonData.ds, 53 | "var-cluster": this.cluster.name, 54 | "var-node": slugify(this.node.metadata.name) 55 | }); 56 | } 57 | 58 | conditionStatus(condition) { 59 | var status; 60 | if (condition.type === "Ready") { 61 | status = condition.status === "True"; 62 | } else { 63 | status = condition.status === "False"; 64 | } 65 | 66 | return { 67 | value: status, 68 | text: status ? "Ok" : "Error" 69 | }; 70 | } 71 | 72 | isConditionOk(condition) { 73 | return this.conditionStatus(condition).value; 74 | } 75 | 76 | conditionLastTransitionTime(condition) { 77 | return moment(condition.lastTransitionTime).format('YYYY-MM-DD HH:mm:ss'); 78 | } 79 | } 80 | 81 | function slugify(str) { 82 | var slug = str.replace("@", "at").replace("&", "and").replace(/[.]/g, "_").replace("/\W+/", ""); 83 | return slug; 84 | } 85 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/clusters/partials/clusters.html: -------------------------------------------------------------------------------- 1 | 8 | 9 |
10 | ...loading 11 |
12 | 13 |
14 |
15 |
16 | 17 |

Looks like you don’t have any clulsters yet.
18 | Add a new cluster 19 |

20 |

Your org does not have any clusters configured. Contact your org admin. 21 |

22 |
23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 48 | 49 | 50 |
Name
35 | 36 | {{cluster.name}} Overview 37 | 38 | 40 | 41 | Cluster Config 42 | 43 |    44 | 45 | 46 | 47 |
51 |
52 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/clusters/partials/node_info.html: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
15 |

Addresses

16 |
17 | 18 | {{addr.type}}: {{addr.address}} 19 | 20 |
21 |
22 |
23 |

Capacity

24 |
25 | 26 | {{k}}: {{v}} 27 | 28 |
29 |
30 |
31 |

Labels

32 |
33 | 34 | {{k}}: {{v}} 35 | 36 |
37 |
38 |
39 | 40 |
41 |

Conditions

42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 59 | 60 | 61 | 62 | 63 |
StatusTypeMessageLast Change
51 | 56 | 57 | {{ctrl.conditionStatus(condition).text}} 58 | {{condition.type}}{{condition.message}}{{ctrl.conditionLastTransitionTime(condition)}}
64 |
65 |
66 | 67 |

Info

68 | 69 | 70 | 71 | 72 | 73 |
{{k}}{{v}}
74 |
75 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/clusters/podInfo.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import moment from 'moment'; 4 | 5 | function slugify(str) { 6 | var slug = str.replace("@", "at").replace("&", "and").replace(/[.]/g, "_").replace("/\W+/", ""); 7 | return slug; 8 | } 9 | 10 | export class PodInfoCtrl { 11 | pageReady: boolean; 12 | pod: any; 13 | cluster_id: any; 14 | clusterDS: any; 15 | datasource: any; 16 | 17 | static templateUrl = 'components/clusters/partials/pod_info.html'; 18 | 19 | /** @ngInject */ 20 | constructor($scope, $injector, private backendSrv, private datasourceSrv, private $q, private $location, private alertSrv) { 21 | document.title = 'Grafana Kubernetes App'; 22 | 23 | this.pageReady = false; 24 | this.pod = {}; 25 | if (!("cluster" in $location.search())) { 26 | alertSrv.set("no cluster specified.", "no cluster specified in url", 'error'); 27 | return; 28 | } else { 29 | this.cluster_id = $location.search().cluster; 30 | let pod_name = $location.search().pod; 31 | 32 | this.loadDatasource(this.cluster_id).then(() => { 33 | this.clusterDS.getPod(pod_name).then(pod => { 34 | this.pod = pod; 35 | this.pageReady = true; 36 | }); 37 | }); 38 | } 39 | } 40 | 41 | loadDatasource(id) { 42 | return this.backendSrv.get('api/datasources/' + id) 43 | .then(ds => { 44 | this.datasource = ds.jsonData.ds; 45 | return this.datasourceSrv.get(ds.name); 46 | }).then(clusterDS => { 47 | this.clusterDS = clusterDS; 48 | return clusterDS; 49 | }); 50 | } 51 | 52 | conditionStatus(condition) { 53 | var status; 54 | if (condition.type === "Ready") { 55 | status = condition.status === "True"; 56 | } else { 57 | status = condition.status === "False"; 58 | } 59 | 60 | return { 61 | value: status, 62 | text: status ? "Ok" : "Error" 63 | }; 64 | } 65 | 66 | goToPodDashboard(pod) { 67 | this.$location.path("dashboard/db/k8s-container") 68 | .search({ 69 | "var-datasource": this.datasource, 70 | "var-cluster": this.clusterDS.name, 71 | "var-node": slugify(pod.spec.nodeName), 72 | "var-namespace": pod.metadata.namespace, 73 | "var-pod": pod.metadata.name 74 | }); 75 | } 76 | 77 | isConditionOk(condition) { 78 | return this.conditionStatus(condition).value; 79 | } 80 | 81 | formatTime(time) { 82 | return moment(time).format('YYYY-MM-DD HH:mm:ss'); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/config/config.html: -------------------------------------------------------------------------------- 1 |

Kubernetes App

2 | This app integrates the data collected from Kubelet, Kube-State Metrics, and Node Exporter with data available via the Kubernetes API. 3 | 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/components/config/config.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | export class KubernetesConfigCtrl { 4 | static templateUrl = 'components/config/config.html'; 5 | enabled: boolean; 6 | appEditCtrl: any; 7 | appModel: any; 8 | 9 | /** @ngInject */ 10 | constructor($scope, $injector, private $q) { 11 | this.enabled = false; 12 | this.appEditCtrl.setPostUpdateHook(this.postUpdate.bind(this)); 13 | } 14 | 15 | postUpdate() { 16 | if (!this.appModel.enabled) { 17 | return this.$q.resolve(); 18 | } 19 | return this.appEditCtrl.importDashboards().then(() => { 20 | this.enabled = true; 21 | return { 22 | url: "plugins/grafana-kubernetes-app/page/clusters", 23 | message: "Kubernetes App enabled!" 24 | }; 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/css/dark.css: -------------------------------------------------------------------------------- 1 | tr.dashlist-item:hover { 2 | background-color: #333; 3 | cursor: pointer; 4 | } 5 | 6 | /* pod nav panel */ 7 | .podnav-wrapper { 8 | display: flex; 9 | flex-direction: row; 10 | justify-content: space-between; 11 | } 12 | 13 | .podnav-tags-wrapper { 14 | width: 60%; 15 | } 16 | 17 | .chosen-tags-container { 18 | display: block; 19 | } 20 | 21 | .chosen-tags-container .label-tag { 22 | line-height: 20px; 23 | margin-bottom: 10px; 24 | } 25 | 26 | .podnav-tags { 27 | display: flex; 28 | flex-direction: column; 29 | flex-wrap: wrap; 30 | align-content: flex-start; 31 | max-height: 300px; 32 | overflow: auto; 33 | } 34 | 35 | .podnav-pods { 36 | width: 40%; 37 | display: flex; 38 | flex-direction: column; 39 | } 40 | 41 | .podnav-results { 42 | display: flex; 43 | flex-direction: column; 44 | overflow: auto; 45 | max-height: 300px; 46 | } 47 | 48 | .podnav-result { 49 | display: block; 50 | padding: 3px 10px; 51 | background-color: #292929; 52 | margin-bottom: 4px; 53 | } 54 | 55 | .podnav-result:hover { 56 | background-color: #333; 57 | cursor: pointer; 58 | } 59 | 60 | .podnav-result button { 61 | margin-right: 15px; 62 | } 63 | 64 | /* plugin config */ 65 | 66 | .pluginconfig-message { 67 | margin: 20px; 68 | } 69 | 70 | .k8s-icon-success { 71 | color: #10a345; 72 | font-size: 24px; 73 | text-decoration: none; 74 | vertical-align: sub; 75 | } 76 | 77 | /* cluster info */ 78 | .main-dash-links { 79 | margin-bottom: 40px; 80 | } 81 | .card-item--main-dash-link { 82 | padding: 20px; 83 | } 84 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/css/light.css: -------------------------------------------------------------------------------- 1 | tr.dashlist-item:hover { 2 | background-color: #ECECEC; 3 | cursor: pointer; 4 | } 5 | 6 | /* pod nav panel */ 7 | .podnav-wrapper { 8 | display: flex; 9 | flex-direction: row; 10 | justify-content: space-between; 11 | } 12 | 13 | .podnav-tags-wrapper { 14 | width: 60%; 15 | } 16 | 17 | .chosen-tags-container { 18 | display: block; 19 | } 20 | 21 | .chosen-tags-container .label-tag { 22 | line-height: 20px; 23 | margin-bottom: 10px; 24 | } 25 | 26 | .podnav-tags { 27 | display: flex; 28 | flex-direction: column; 29 | flex-wrap: wrap; 30 | align-content: flex-start; 31 | max-height: 300px; 32 | overflow: auto; 33 | } 34 | 35 | .podnav-pods { 36 | width: 40%; 37 | display: flex; 38 | flex-direction: column; 39 | } 40 | 41 | .podnav-results { 42 | display: flex; 43 | flex-direction: column; 44 | overflow: auto; 45 | max-height: 300px; 46 | } 47 | 48 | .podnav-result { 49 | display: block; 50 | padding: 3px 10px; 51 | background-color: #f4f5f8; 52 | margin-bottom: 4px; 53 | } 54 | 55 | .podnav-result:hover { 56 | background-color: #ECECEC; 57 | cursor: pointer; 58 | } 59 | 60 | .podnav-result button { 61 | margin-right: 15px; 62 | } 63 | 64 | /* plugin config */ 65 | 66 | .pluginconfig-message { 67 | margin: 20px; 68 | } 69 | 70 | .k8s-icon-success { 71 | color: #10a345; 72 | font-size: 24px; 73 | text-decoration: none; 74 | vertical-align: sub; 75 | } 76 | 77 | /* cluster info */ 78 | .main-dash-links { 79 | margin-bottom: 40px; 80 | } 81 | .card-item--main-dash-link { 82 | padding: 20px; 83 | } 84 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/datasource/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {K8sDatasource} from './datasource'; 4 | import {K8sQueryCtrl} from './query_ctrl'; 5 | 6 | class K8sConfigCtrl { 7 | static templateUrl = 'datasource/partials/config.html'; 8 | } 9 | 10 | export { 11 | K8sDatasource as Datasource, 12 | K8sQueryCtrl as QueryCtrl, 13 | K8sConfigCtrl as ConfigCtrl 14 | }; -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/datasource/partials/config.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/datasource/partials/query.editor.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |
5 |
6 |
-------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/datasource/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Kubernetes", 3 | "id": "grafana-kubernetes-datasource", 4 | "type": "datasource", 5 | 6 | "staticRoot": ".", 7 | 8 | "partials": { 9 | "config": "public/app/plugins/grafana-kubernetes-app/datasource/partials/config.html" 10 | }, 11 | 12 | "metrics": true, 13 | "annotations": false, 14 | 15 | "info": { 16 | "description": "Kubernetes datasource", 17 | "author": { 18 | "name": "Grafana Labs", 19 | "url": "https://grafana.com/" 20 | }, 21 | "logos": { 22 | "small": "img/logo.svg", 23 | "large": "img/logo.svg" 24 | }, 25 | "links": [ 26 | {"name": "GitHub", "url": "https://github.com/grafana/kubernetes-app"}, 27 | {"name": "License", "url": "https://github.com/grafana/kubernetes-app/blob/master/LICENSE"} 28 | ], 29 | "version": "0.0.1", 30 | "updated": "2018-01-18" 31 | }, 32 | 33 | "dependencies": { 34 | "grafanaVersion": "5.x.x", 35 | "plugins": [ ] 36 | } 37 | } -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/datasource/query_ctrl.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import _ from 'lodash'; 3 | import {QueryCtrl} from 'app/plugins/sdk'; 4 | 5 | export class K8sQueryCtrl extends QueryCtrl { 6 | static templateUrl = 'datasource/partials/query.editor.html'; 7 | 8 | defaults = { 9 | }; 10 | 11 | /** @ngInject **/ 12 | constructor($scope, $injector, private templateSrv) { 13 | super($scope, $injector); 14 | 15 | _.defaultsDeep(this.target, this.defaults); 16 | 17 | this.target.target = this.target.target || ''; 18 | this.target.type = this.target.type || 'timeserie'; 19 | } 20 | 21 | getOptions(query) { 22 | return this.datasource.metricFindQuery(''); 23 | } 24 | 25 | onChangeInternal() { 26 | this.panelCtrl.refresh(); // Asks the panel to refresh data. 27 | } 28 | } -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/app-menu-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/app-menu-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/cluster-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/cluster-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/container-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/container-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/namespace-details-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/namespace-details-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/node-dashboard-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/node-dashboard-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/overview-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/overview-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/pod-details-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/img/pod-details-screenshot.png -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/module.ts: -------------------------------------------------------------------------------- 1 | import {KubernetesConfigCtrl} from './components/config/config'; 2 | import {ClustersCtrl} from './components/clusters/clusters'; 3 | import {ClusterConfigCtrl} from './components/clusters/clusterConfig'; 4 | import {ClusterInfoCtrl} from './components/clusters/clusterInfo'; 5 | import {ClusterWorkloadsCtrl} from './components/clusters/clusterWorkloads'; 6 | import {NodeInfoCtrl} from './components/clusters/nodeInfo'; 7 | import {PodInfoCtrl} from './components/clusters/podInfo'; 8 | import {loadPluginCss} from 'app/plugins/sdk'; 9 | 10 | loadPluginCss({ 11 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 12 | light: 'plugins/grafana-kubernetes-app/css/light.css' 13 | }); 14 | 15 | export { 16 | KubernetesConfigCtrl as ConfigCtrl, 17 | ClustersCtrl, 18 | ClusterConfigCtrl, 19 | ClusterInfoCtrl, 20 | ClusterWorkloadsCtrl, 21 | NodeInfoCtrl, 22 | PodInfoCtrl 23 | }; 24 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/panels/nodeData/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {NodeDataCtrl} from './nodeData'; 4 | import {loadPluginCss} from 'app/plugins/sdk'; 5 | 6 | loadPluginCss({ 7 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 8 | light: 'plugins/grafana-kubernetes-app/css/light.css' 9 | }); 10 | 11 | export { 12 | NodeDataCtrl as PanelCtrl 13 | }; 14 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/panels/nodeData/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "panel", 3 | "name": "Kubernetes Node Info", 4 | "id": "prometheus-kubernetes-nodeinfo-panel" 5 | } 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/panels/podNav/module.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | import {PodNavCtrl} from './podNav'; 4 | import {loadPluginCss} from 'app/plugins/sdk'; 5 | 6 | loadPluginCss({ 7 | dark: 'plugins/grafana-kubernetes-app/css/dark.css', 8 | light: 'plugins/grafana-kubernetes-app/css/light.css' 9 | }); 10 | 11 | export { 12 | PodNavCtrl as PanelCtrl 13 | }; 14 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/panels/podNav/partials/pod_nav.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Filter Pods By Kubernetes Tag

4 |
5 | 6 | 7 | {{tag}}={{value}} 8 | 9 | 10 |
11 |
12 |
13 |
14 | 17 |
18 | 21 |
22 |
23 |
24 |
25 |
26 |
27 |

Filter by Pod Name

28 |
29 | 30 | 31 | {{podTag}} 32 | 33 | 34 |
35 |
36 | 37 | 38 | {{pod}} 39 | 40 |
41 |
42 |
43 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/src/panels/podNav/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "panel", 3 | "name": "Kubernetes Pod Nav", 4 | "id": "prometheus-kubernetes-podnav-panel" 5 | } 6 | -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "target": "ES5", 5 | "module": "system", 6 | "sourceMap": true, 7 | "declaration": true, 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "noImplicitAny": false 11 | }, 12 | "exclude": [ 13 | "./node_modules/**" 14 | ] 15 | } -------------------------------------------------------------------------------- /source/prometheus/grafana/plugins/grafana-kubernetes-app-31da38a/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [false, "check-space"], 5 | "curly": true, 6 | "eofline": true, 7 | "forin": false, 8 | "indent": [true, "spaces"], 9 | "label-position": true, 10 | "label-undefined": true, 11 | "max-line-length": [true, 140], 12 | "member-access": false, 13 | "no-arg": true, 14 | "no-bitwise": true, 15 | "no-console": [true, 16 | "debug", 17 | "info", 18 | "time", 19 | "timeEnd", 20 | "trace" 21 | ], 22 | "no-construct": true, 23 | "no-debugger": true, 24 | "no-duplicate-key": true, 25 | "no-duplicate-variable": true, 26 | "no-empty": false, 27 | "no-eval": true, 28 | "no-inferrable-types": true, 29 | "no-shadowed-variable": false, 30 | "no-string-literal": false, 31 | "no-switch-case-fall-through": false, 32 | "no-trailing-whitespace": true, 33 | "no-unused-expression": false, 34 | "no-unused-variable": false, 35 | "no-unreachable": true, 36 | "no-use-before-declare": true, 37 | "no-var-keyword": false, 38 | "object-literal-sort-keys": false, 39 | "one-line": [true, 40 | "check-open-brace", 41 | "check-catch", 42 | "check-else" 43 | ], 44 | "radix": false, 45 | "semicolon": true, 46 | "triple-equals": [true, "allow-null-check"], 47 | "typedef-whitespace": [true, { 48 | "call-signature": "nospace", 49 | "index-signature": "nospace", 50 | "parameter": "nospace", 51 | "property-declaration": "nospace", 52 | "variable-declaration": "nospace" 53 | }], 54 | "variable-name": [true, "ban-keywords"], 55 | "whitespace": [true, 56 | "check-branch", 57 | "check-decl", 58 | "check-type" 59 | ] 60 | } 61 | } -------------------------------------------------------------------------------- /source/prometheus/kube-state-metrics-deployment.yaml.tpl: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: kube-state-metrics 5 | namespace: kube-system 6 | labels: 7 | k8s-app: kube-state-metrics 8 | kubernetes.io/cluster-service: "true" 9 | addonmanager.kubernetes.io/mode: Reconcile 10 | version: v1.3.0 11 | spec: 12 | selector: 13 | matchLabels: 14 | k8s-app: kube-state-metrics 15 | version: v1.3.0 16 | replicas: 1 17 | template: 18 | metadata: 19 | labels: 20 | k8s-app: kube-state-metrics 21 | version: v1.3.0 22 | spec: 23 | priorityClassName: system-cluster-critical 24 | serviceAccountName: kube-state-metrics 25 | containers: 26 | - name: kube-state-metrics 27 | image: PRI_DOCKER_HOST:5000/quay.io/coreos/kube-state-metrics:v1.3.0 28 | ports: 29 | - name: http-metrics 30 | containerPort: 8080 31 | - name: telemetry 32 | containerPort: 8081 33 | readinessProbe: 34 | httpGet: 35 | path: /healthz 36 | port: 8080 37 | initialDelaySeconds: 5 38 | timeoutSeconds: 5 39 | - name: addon-resizer 40 | image: PRI_DOCKER_HOST:5000/k8s.gcr.io/addon-resizer:1.8.5 41 | resources: 42 | limits: 43 | cpu: 100m 44 | memory: 30Mi 45 | requests: 46 | cpu: 100m 47 | memory: 30Mi 48 | env: 49 | - name: MY_POD_NAME 50 | valueFrom: 51 | fieldRef: 52 | fieldPath: metadata.name 53 | - name: MY_POD_NAMESPACE 54 | valueFrom: 55 | fieldRef: 56 | fieldPath: metadata.namespace 57 | volumeMounts: 58 | - name: config-volume 59 | mountPath: /etc/config 60 | command: 61 | - /pod_nanny 62 | - --config-dir=/etc/config 63 | - --container=kube-state-metrics 64 | - --cpu=100m 65 | - --extra-cpu=1m 66 | - --memory=100Mi 67 | - --extra-memory=2Mi 68 | - --threshold=5 69 | - --deployment=kube-state-metrics 70 | volumes: 71 | - name: config-volume 72 | configMap: 73 | name: kube-state-metrics-config 74 | --- 75 | # Config map for resource configuration. 76 | apiVersion: v1 77 | kind: ConfigMap 78 | metadata: 79 | name: kube-state-metrics-config 80 | namespace: kube-system 81 | labels: 82 | k8s-app: kube-state-metrics 83 | kubernetes.io/cluster-service: "true" 84 | addonmanager.kubernetes.io/mode: Reconcile 85 | data: 86 | NannyConfiguration: |- 87 | apiVersion: nannyconfig/v1alpha1 88 | kind: NannyConfiguration 89 | 90 | -------------------------------------------------------------------------------- /source/prometheus/kube-state-metrics-rbac.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: kube-state-metrics 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: Reconcile 9 | --- 10 | apiVersion: rbac.authorization.k8s.io/v1 11 | kind: ClusterRole 12 | metadata: 13 | name: kube-state-metrics 14 | labels: 15 | kubernetes.io/cluster-service: "true" 16 | addonmanager.kubernetes.io/mode: Reconcile 17 | rules: 18 | - apiGroups: [""] 19 | resources: 20 | - configmaps 21 | - secrets 22 | - nodes 23 | - pods 24 | - services 25 | - resourcequotas 26 | - replicationcontrollers 27 | - limitranges 28 | - persistentvolumeclaims 29 | - persistentvolumes 30 | - namespaces 31 | - endpoints 32 | verbs: ["list", "watch"] 33 | - apiGroups: ["extensions"] 34 | resources: 35 | - daemonsets 36 | - deployments 37 | - replicasets 38 | verbs: ["list", "watch"] 39 | - apiGroups: ["apps"] 40 | resources: 41 | - statefulsets 42 | verbs: ["list", "watch"] 43 | - apiGroups: ["batch"] 44 | resources: 45 | - cronjobs 46 | - jobs 47 | verbs: ["list", "watch"] 48 | - apiGroups: ["autoscaling"] 49 | resources: 50 | - horizontalpodautoscalers 51 | verbs: ["list", "watch"] 52 | --- 53 | apiVersion: rbac.authorization.k8s.io/v1 54 | kind: Role 55 | metadata: 56 | name: kube-state-metrics-resizer 57 | namespace: kube-system 58 | labels: 59 | kubernetes.io/cluster-service: "true" 60 | addonmanager.kubernetes.io/mode: Reconcile 61 | rules: 62 | - apiGroups: [""] 63 | resources: 64 | - pods 65 | verbs: ["get"] 66 | - apiGroups: ["extensions"] 67 | resources: 68 | - deployments 69 | resourceNames: ["kube-state-metrics"] 70 | verbs: ["get", "update"] 71 | --- 72 | apiVersion: rbac.authorization.k8s.io/v1 73 | kind: ClusterRoleBinding 74 | metadata: 75 | name: kube-state-metrics 76 | labels: 77 | kubernetes.io/cluster-service: "true" 78 | addonmanager.kubernetes.io/mode: Reconcile 79 | roleRef: 80 | apiGroup: rbac.authorization.k8s.io 81 | kind: ClusterRole 82 | name: kube-state-metrics 83 | subjects: 84 | - kind: ServiceAccount 85 | name: kube-state-metrics 86 | namespace: kube-system 87 | --- 88 | apiVersion: rbac.authorization.k8s.io/v1 89 | kind: RoleBinding 90 | metadata: 91 | name: kube-state-metrics 92 | namespace: kube-system 93 | labels: 94 | kubernetes.io/cluster-service: "true" 95 | addonmanager.kubernetes.io/mode: Reconcile 96 | roleRef: 97 | apiGroup: rbac.authorization.k8s.io 98 | kind: Role 99 | name: kube-state-metrics-resizer 100 | subjects: 101 | - kind: ServiceAccount 102 | name: kube-state-metrics 103 | namespace: kube-system 104 | -------------------------------------------------------------------------------- /source/prometheus/kube-state-metrics-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: kube-state-metrics 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: Reconcile 9 | kubernetes.io/name: "kube-state-metrics" 10 | annotations: 11 | prometheus.io/scrape: 'true' 12 | spec: 13 | ports: 14 | - name: http-metrics 15 | port: 8080 16 | targetPort: http-metrics 17 | protocol: TCP 18 | - name: telemetry 19 | port: 8081 20 | targetPort: telemetry 21 | protocol: TCP 22 | selector: 23 | k8s-app: kube-state-metrics 24 | -------------------------------------------------------------------------------- /source/prometheus/node-exporter-ds.yaml.tpl: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: DaemonSet 3 | metadata: 4 | name: node-exporter 5 | namespace: kube-system 6 | labels: 7 | k8s-app: node-exporter 8 | kubernetes.io/cluster-service: "true" 9 | addonmanager.kubernetes.io/mode: Reconcile 10 | version: v0.18.1 11 | spec: 12 | selector: 13 | matchLabels: 14 | k8s-app: node-exporter 15 | version: v0.18.1 16 | updateStrategy: 17 | type: OnDelete 18 | template: 19 | metadata: 20 | labels: 21 | k8s-app: node-exporter 22 | version: v0.18.1 23 | spec: 24 | priorityClassName: system-node-critical 25 | containers: 26 | - name: prometheus-node-exporter 27 | image: "PRI_DOCKER_HOST:5000/prom/node-exporter:v0.18.1" 28 | imagePullPolicy: "IfNotPresent" 29 | args: 30 | - --path.procfs=/host/proc 31 | - --path.sysfs=/host/sys 32 | ports: 33 | - name: metrics 34 | containerPort: 9100 35 | hostPort: 9100 36 | volumeMounts: 37 | - name: proc 38 | mountPath: /host/proc 39 | readOnly: true 40 | - name: sys 41 | mountPath: /host/sys 42 | readOnly: true 43 | resources: 44 | limits: 45 | memory: 50Mi 46 | requests: 47 | cpu: 100m 48 | memory: 50Mi 49 | hostNetwork: true 50 | hostPID: true 51 | volumes: 52 | - name: proc 53 | hostPath: 54 | path: /proc 55 | - name: sys 56 | hostPath: 57 | path: /sys 58 | -------------------------------------------------------------------------------- /source/prometheus/node-exporter-service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: node-exporter 5 | namespace: kube-system 6 | annotations: 7 | prometheus.io/scrape: "true" 8 | labels: 9 | kubernetes.io/cluster-service: "true" 10 | addonmanager.kubernetes.io/mode: Reconcile 11 | kubernetes.io/name: "NodeExporter" 12 | spec: 13 | clusterIP: None 14 | ports: 15 | - name: metrics 16 | port: 9100 17 | protocol: TCP 18 | targetPort: 9100 19 | selector: 20 | k8s-app: node-exporter 21 | -------------------------------------------------------------------------------- /source/prometheus/persistentvolume.yaml: -------------------------------------------------------------------------------- 1 | kind: PersistentVolume 2 | apiVersion: v1 3 | metadata: 4 | name: pv-volume-prometheus 5 | spec: 6 | storageClassName: prometheus 7 | capacity: 8 | storage: 16Gi 9 | accessModes: 10 | - ReadWriteOnce 11 | hostPath: 12 | path: "/data/persistentvolume_prometheus" 13 | --- 14 | kind: PersistentVolume 15 | apiVersion: v1 16 | metadata: 17 | name: pv-volume-alertmanager 18 | spec: 19 | storageClassName: alertmanager 20 | capacity: 21 | storage: 2Gi 22 | accessModes: 23 | - ReadWriteOnce 24 | hostPath: 25 | path: "/data/persistentvolume_alertmanager" 26 | --- 27 | kind: PersistentVolume 28 | apiVersion: v1 29 | metadata: 30 | name: pv-volume-grafana 31 | spec: 32 | storageClassName: grafana 33 | capacity: 34 | storage: 2Gi 35 | accessModes: 36 | - ReadWriteOnce 37 | hostPath: 38 | path: "/data/persistentvolume_grafana" 39 | -------------------------------------------------------------------------------- /source/prometheus/prometheus-rbac.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: prometheus 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/cluster-service: "true" 8 | addonmanager.kubernetes.io/mode: Reconcile 9 | --- 10 | apiVersion: rbac.authorization.k8s.io/v1 11 | kind: ClusterRole 12 | metadata: 13 | name: prometheus 14 | labels: 15 | kubernetes.io/cluster-service: "true" 16 | addonmanager.kubernetes.io/mode: Reconcile 17 | rules: 18 | - apiGroups: 19 | - "" 20 | resources: 21 | - nodes 22 | - nodes/metrics 23 | - services 24 | - endpoints 25 | - pods 26 | verbs: 27 | - get 28 | - list 29 | - watch 30 | - apiGroups: 31 | - "" 32 | resources: 33 | - configmaps 34 | verbs: 35 | - get 36 | - nonResourceURLs: 37 | - "/metrics" 38 | verbs: 39 | - get 40 | --- 41 | apiVersion: rbac.authorization.k8s.io/v1 42 | kind: ClusterRoleBinding 43 | metadata: 44 | name: prometheus 45 | labels: 46 | kubernetes.io/cluster-service: "true" 47 | addonmanager.kubernetes.io/mode: Reconcile 48 | roleRef: 49 | apiGroup: rbac.authorization.k8s.io 50 | kind: ClusterRole 51 | name: prometheus 52 | subjects: 53 | - kind: ServiceAccount 54 | name: prometheus 55 | namespace: kube-system 56 | -------------------------------------------------------------------------------- /source/prometheus/prometheus-service.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | name: prometheus 5 | namespace: kube-system 6 | labels: 7 | kubernetes.io/name: "Prometheus" 8 | kubernetes.io/cluster-service: "true" 9 | addonmanager.kubernetes.io/mode: Reconcile 10 | spec: 11 | type: NodePort 12 | ports: 13 | - name: http 14 | port: 9090 15 | protocol: TCP 16 | targetPort: 9090 17 | nodePort: 30002 18 | selector: 19 | k8s-app: prometheus 20 | -------------------------------------------------------------------------------- /source/web_test/Dockerfile.tpl: -------------------------------------------------------------------------------- 1 | # docker build -t="PRI_DOCKER_HOST:5000/esn-containers/hello:1.0" . 2 | # CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-w' -o server ./hello.go 3 | 4 | FROM PRI_DOCKER_HOST:5000/esn-containers/esn_base:1.0 5 | 6 | MAINTAINER shenghua bi 7 | 8 | COPY server /server 9 | -------------------------------------------------------------------------------- /source/web_test/create.sh.tpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | proName=web_test 4 | 5 | source /etc/profile 6 | 7 | date=$(date "+%Y%m%d.%H%M%S") 8 | imageName=PRI_DOCKER_HOST:5000/esn-containers/$proName:$date 9 | 10 | cp -rp yaml/pod.yaml.tpl yaml/pod.yaml 11 | sed -i "s#PRO_IMAGE#$imageName#g" yaml/pod.yaml 12 | 13 | docker build -t="$imageName" . 14 | docker push $imageName 15 | 16 | kubectl create namespace esn-system 17 | kubectl apply -f yaml/pod.yaml 18 | kubectl apply -f yaml/svc.yaml 19 | 20 | echo $imageName >> ./image_version 21 | -------------------------------------------------------------------------------- /source/web_test/server/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/source/web_test/server/hello -------------------------------------------------------------------------------- /source/web_test/server/start_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | nohup /server/hello > /data/log/nginx/hello.log 2>&1 & 4 | -------------------------------------------------------------------------------- /source/web_test/server/stop_cmd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ps aux | grep hello | grep -v grep | awk '{print $1}' | xargs kill -9 4 | -------------------------------------------------------------------------------- /source/web_test/yaml/pod.yaml.tpl: -------------------------------------------------------------------------------- 1 | kind: Deployment 2 | apiVersion: apps/v1 3 | metadata: 4 | labels: 5 | app: web-test 6 | name: web-test 7 | namespace: esn-system 8 | spec: 9 | replicas: 1 10 | minReadySeconds: 10 #滚动升级时10s后认为该pod就绪 11 | strategy: 12 | rollingUpdate: ##由于replicas为3,则整个升级,pod个数在2-4个之间 13 | maxSurge: 1 #滚动升级时会先启动1个pod 14 | maxUnavailable: 1 #滚动升级时允许的最大Unavailable的pod个数 15 | selector: 16 | matchLabels: 17 | app: web-test 18 | template: 19 | metadata: 20 | labels: 21 | app: web-test 22 | spec: 23 | volumes: 24 | - name: accesslog 25 | hostPath: 26 | path: /data/log/nginx 27 | - name: errorlog 28 | hostPath: 29 | path: /data/log/php 30 | containers: 31 | - name: web-test 32 | #image: PRI_DOCKER_HOST:5000/esn-containers/web_test:1.0 33 | image: PRO_IMAGE 34 | resources: 35 | limits: 36 | memory: 100Mi 37 | requests: 38 | memory: 80Mi 39 | lifecycle: 40 | postStart: 41 | exec: 42 | command: ["/server/start_cmd.sh"] 43 | preStop: 44 | exec: 45 | #SIGTERM triggers a quick exit; gracefully terminate instead (SIGTERM触发快速退出;而优雅地终止) 将会在发送SIGTERM之前执行 46 | command: ["/server/stop_cmd.sh"] 47 | imagePullPolicy: Always 48 | ports: 49 | - containerPort: 80 50 | protocol: TCP 51 | livenessProbe: #(活性探针) 52 | tcpSocket: 53 | port: 80 54 | initialDelaySeconds: 6 55 | periodSeconds: 3 56 | readinessProbe: 57 | tcpSocket: 58 | port: 80 59 | initialDelaySeconds: 4 60 | periodSeconds: 2 61 | volumeMounts: 62 | - mountPath: /data/log/nginx 63 | name: accesslog 64 | - mountPath: /data/log/php 65 | name: errorlog 66 | #nodeSelector: 67 | #othersvc: othersys 68 | -------------------------------------------------------------------------------- /source/web_test/yaml/svc.yaml: -------------------------------------------------------------------------------- 1 | kind: Service 2 | apiVersion: v1 3 | metadata: 4 | labels: 5 | app: web-test 6 | name: web-test 7 | namespace: esn-system 8 | spec: 9 | #type: ClusterIP 10 | type: NodePort 11 | #type: LoadBalancer 12 | ports: 13 | - port: 80 14 | targetPort: 80 15 | nodePort: 31000 16 | selector: 17 | app: web-test 18 | -------------------------------------------------------------------------------- /sysbase/Makefile: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL:=help 2 | 3 | .EXPORT_ALL_VARIABLES: 4 | 5 | ifndef VERBOSE 6 | .SILENT: 7 | endif 8 | 9 | SHELL=/bin/bash -o pipefail -o errexit 10 | 11 | export GO111MODULE=on 12 | # export GIN_MODE=release 13 | 14 | DISTDIR:=$(shell pwd)/sysbase 15 | T:=$(shell mkdir -p $(DISTDIR)/bin) 16 | 17 | REPO_INFO ?= $(shell git config --get remote.origin.url) 18 | COMMIT_SHA ?= $(shell git rev-parse --short HEAD) 19 | COMMIT_TIME ?= $(shell git show --pretty="%ci %cr" | head -1 | awk '{print $$1"/"$$2"/"$$3}') 20 | BUILD_TIME ?= $(shell date "+%Y-%m-%d/%H:%M:%S/%z") 21 | VERSION ?= v1.0.0 22 | 23 | LDFLAGS=-w -X sysbase/version.Pkg=$(REPO_INFO) -X sysbase/version.Version=$(VERSION) -X sysbase/version.GitCommitSha=$(COMMIT_SHA) -X sysbase/version.GitCommitTime=$(COMMIT_TIME) -X sysbase/version.BuildTime=$(BUILD_TIME) 24 | 25 | HOST_ARCH = $(shell which go >/dev/null 2>&1 && go env GOARCH) 26 | HOST_OS = $(shell which go >/dev/null 2>&1 && go env GOOS) 27 | ARCH ?= $(HOST_ARCH) 28 | OS ?= $(HOST_OS) 29 | 30 | ifeq ($(ARCH),) 31 | $(error mandatory variable ARCH is empty, either set it when calling the command or make sure 'go env GOARCH' works) 32 | endif 33 | 34 | help: ## 请查看下面帮助 35 | @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) 36 | 37 | .PHONY: build 38 | build: ## 编译 sysbase 39 | @cd backend && \ 40 | rm -rf $(DISTDIR)/bin/sysbase-$(ARCH) && \ 41 | go mod tidy && \ 42 | CGO_ENABLED=1 \ 43 | GOOS=$(OS) \ 44 | GOARCH=$(ARCH) \ 45 | go build -ldflags "$(LDFLAGS)" -o $(DISTDIR)/bin/sysbase-$(VERSION)-$(OS)-$(ARCH) ./ 46 | 47 | .PHONY: runf 48 | runf: ## 运行 sysbase 前端 49 | @cd frontend && \ 50 | yarn serve 51 | 52 | .PHONY: runb 53 | runb: ## 运行 sysbase 后端 54 | @cd backend && \ 55 | go mod tidy && \ 56 | CGO_ENABLED=1 \ 57 | GOOS=$(OS) \ 58 | GOARCH=$(ARCH) \ 59 | go run -ldflags "$(LDFLAGS)" ./ 60 | 61 | .PHONY: runbin 62 | runbin: ## 运行 sysbase 后端 63 | @cd $(DISTDIR) && \ 64 | ./bin/sysbase-$(VERSION)-$(OS)-$(ARCH) 65 | 66 | .PHONY: package 67 | package: dist build ## 打包 sysbase 68 | @/bin/cp -rpf backend/etc $(DISTDIR)/ && \ 69 | /bin/cp -rpf backend/etc/config.js $(DISTDIR)/static 70 | 71 | .PHONY: dist 72 | dist: ## 打包 sysbase 前端 73 | @cd frontend && \ 74 | yarn build && \ 75 | rm -rf $(DISTDIR)/static && \ 76 | mv dist $(DISTDIR)/static 77 | 78 | .PHONY: clean 79 | clean: ## 清理 sysbase 80 | @rm -rf $(DISTDIR) && \ 81 | mkdir -p $(DISTDIR)/bin 82 | -------------------------------------------------------------------------------- /sysbase/README.md: -------------------------------------------------------------------------------- 1 | Mac下部署:(其他系统类似,参考Makefile) 2 | # make mac 3 | # make static 4 | # make run 5 | 6 | 安装最新稳定版: 7 | =============== 8 | #### 版本说明 9 | 10 | | service | version | 11 | |----------------------|---------| 12 | | `kubernetes` | v1.32.3 | 13 | | `etcd` | 3.5.21 | 14 | | `istio` | 1.25.1 | 15 | | `containerd` | v1.7.27 | 16 | | `calico` | v3.29.3 | 17 | | `coredns` | v1.12.0 | 18 | | `dashboard` | v2.7.0 | 19 | | `metrics-server` | v0.7.2 | 20 | | `prometheus` | v3.2.1 | 21 | | `alertmanager` | v0.28.1 | 22 | | `grafana` | 11.6.0 | 23 | | `kube-state-metrics` | v2.15.0 | 24 | | `node-exporter` | v1.9.0 | 25 | | `helm` | v3.17.2 | 26 | | `cfssl` | v1.6.5 | 27 | | `runc` | v1.2.6 | 28 | | `crictl` | v1.32.0 | 29 | | `nerdctl` | v2.0.4 | 30 | | `cni` | v1.6.2 | -------------------------------------------------------------------------------- /sysbase/backend/README.md: -------------------------------------------------------------------------------- 1 | #### 版本说明 2 | 3 | | service | version | 4 | |----------------------|---------| 5 | | `kubernetes` | v1.32.3 | 6 | | `etcd` | 3.5.21 | 7 | | `istio` | 1.25.1 | 8 | | `containerd` | v1.7.27 | 9 | | `calico` | v3.29.3 | 10 | | `coredns` | v1.12.0 | 11 | | `dashboard` | v2.7.0 | 12 | | `metrics-server` | v0.7.2 | 13 | | `prometheus` | v3.2.1 | 14 | | `alertmanager` | v0.28.1 | 15 | | `grafana` | 11.6.0 | 16 | | `kube-state-metrics` | v2.15.0 | 17 | | `node-exporter` | v1.9.0 | 18 | | `helm` | v3.17.2 | 19 | | `cfssl` | v1.6.5 | 20 | | `runc` | v1.2.6 | 21 | | `crictl` | v1.32.0 | 22 | | `nerdctl` | v2.0.4 | 23 | | `cni` | v1.6.2 | -------------------------------------------------------------------------------- /sysbase/backend/args/builder.go: -------------------------------------------------------------------------------- 1 | package args 2 | 3 | import "net" 4 | 5 | var builder = &holderBuilder{holder: Holder} 6 | 7 | // Used to build argument holder structure. It is private to make sure that only 1 instance can be created 8 | // that modifies singleton instance of argument holder. 9 | type holderBuilder struct { 10 | holder *holder 11 | } 12 | 13 | // SetPort 'port' argument of Dashboard binary. 14 | func (self *holderBuilder) SetPort(port int) *holderBuilder { 15 | self.holder.port = port 16 | return self 17 | } 18 | 19 | // SetBindAddress 'bind-address' argument of Dashboard binary. 20 | func (self *holderBuilder) SetBindAddress(ip net.IP) *holderBuilder { 21 | self.holder.bindAddress = ip 22 | return self 23 | } 24 | 25 | // GetHolderBuilder returns singleton instance of argument holder builder. 26 | func GetHolderBuilder() *holderBuilder { 27 | return builder 28 | } 29 | -------------------------------------------------------------------------------- /sysbase/backend/args/holder.go: -------------------------------------------------------------------------------- 1 | package args 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | var Holder = &holder{} 8 | 9 | type holder struct { 10 | port int 11 | bindAddress net.IP 12 | } 13 | 14 | // GetPort 'port' argument of Dashboard binary. 15 | func (self *holder) GetPort() int { 16 | return self.port 17 | } 18 | 19 | // GetBindAddress 'bind-address' argument of Dashboard binary. 20 | func (self *holder) GetBindAddress() net.IP { 21 | return self.bindAddress 22 | } 23 | -------------------------------------------------------------------------------- /sysbase/backend/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "os" 5 | 6 | "gopkg.in/yaml.v2" 7 | ) 8 | 9 | type ( 10 | Config struct { 11 | Static string `yaml:"static"` 12 | Db Db `yaml:"db"` 13 | InstallK8s InstallK8s `yaml:"install-k8s"` 14 | } 15 | Db []struct { 16 | Name string `yaml:"name"` 17 | Type string `yaml:"type"` 18 | Dsn string `yaml:"dsn"` 19 | MaxOpenConns int `yaml:"set_max_open_conns"` 20 | TablePrefix string `yaml:"table_prefix"` 21 | } 22 | InstallK8s struct { 23 | SourceDir string `yaml:"source-dir"` 24 | } 25 | ) 26 | 27 | func (c *Config) ReadConfigFile(fileName string) error { 28 | data, err := os.ReadFile(fileName) 29 | if err != nil { 30 | return err 31 | } 32 | 33 | if err := yaml.Unmarshal([]byte(data), c); err != nil { 34 | return err 35 | } 36 | return nil 37 | } 38 | 39 | func (c *Config) WriteConfigFile() error { 40 | data, err := yaml.Marshal(c) 41 | if err != nil { 42 | return err 43 | } 44 | 45 | execPath, err := os.Getwd() 46 | if err != nil { 47 | return err 48 | } 49 | 50 | configPath := execPath + "/etc/config.yaml" 51 | err = os.WriteFile(configPath, data, 0755) 52 | if err != nil { 53 | return err 54 | } 55 | 56 | return nil 57 | } 58 | -------------------------------------------------------------------------------- /sysbase/backend/etc/config-demo.yaml: -------------------------------------------------------------------------------- 1 | static: static 2 | 3 | # 数据库配置 4 | db: 5 | - name: "sysbase" 6 | type: "sqlite" 7 | dsn: "file:sysbase.db?_auth&_auth_user=admin&_auth_pass=123456&_auth_crypt=sha256" 8 | max_open_conns: 100 9 | table_prefix: "" 10 | 11 | install-k8s: 12 | source-dir: /data/installk8s -------------------------------------------------------------------------------- /sysbase/backend/etc/config.js: -------------------------------------------------------------------------------- 1 | window.CONFIG = { 2 | apiHost: 'http://127.0.0.1:8081/', 3 | perPage: 20, 4 | } -------------------------------------------------------------------------------- /sysbase/backend/etc/config.yaml: -------------------------------------------------------------------------------- 1 | static: static 2 | 3 | # 数据库配置 4 | db: 5 | - name: "sysbase" 6 | type: "sqlite" 7 | dsn: "file:sysbase.db?_auth&_auth_user=admin&_auth_pass=123456&_auth_crypt=sha256" 8 | max_open_conns: 100 9 | table_prefix: "" 10 | 11 | install-k8s: 12 | source-dir: /data/installk8s -------------------------------------------------------------------------------- /sysbase/backend/go.mod: -------------------------------------------------------------------------------- 1 | module sysbase 2 | 3 | go 1.15 4 | 5 | replace sysbase => ../../sysbase 6 | 7 | require ( 8 | github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 9 | github.com/gin-gonic/gin v1.9.0 10 | github.com/hnakamur/go-scp v1.0.2 11 | github.com/pkg/sftp v1.13.5 12 | github.com/spf13/pflag v1.0.5 13 | golang.org/x/crypto v0.8.0 14 | gopkg.in/yaml.v2 v2.4.0 15 | gorm.io/driver/sqlite v1.5.7 16 | gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde 17 | ) 18 | -------------------------------------------------------------------------------- /sysbase/backend/handler/k8scluster.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | "strconv" 6 | "strings" 7 | 8 | "github.com/gin-gonic/gin" 9 | 10 | "sysbase/model" 11 | ) 12 | 13 | type K8sClusterHandler struct{} 14 | 15 | func (kch *K8sClusterHandler) Create(c *gin.Context) { 16 | name := strings.TrimSpace(c.PostForm("Name")) 17 | resourceID := strings.TrimSpace(c.PostForm("ResourceID")) 18 | 19 | resp := Response{ 20 | Code: 10000, 21 | Msg: "", 22 | } 23 | 24 | k8sCluster := model.K8sCluster{ 25 | Name: name, 26 | } 27 | 28 | r, err := k8sCluster.Insert(resourceID) 29 | if err == nil { 30 | resp.Data = r 31 | } else { 32 | resp.Code = 10001 33 | resp.Msg = err.Error() 34 | } 35 | 36 | c.JSON(http.StatusOK, resp) 37 | } 38 | 39 | func (kch *K8sClusterHandler) List(c *gin.Context) { 40 | resp := Response{ 41 | Code: 10000, 42 | Msg: "", 43 | } 44 | 45 | k8sCluster := model.K8sCluster{} 46 | 47 | r, err := k8sCluster.List() 48 | if err == nil { 49 | resp.Data = r 50 | } else { 51 | resp.Code = 10001 52 | resp.Msg = err.Error() 53 | } 54 | 55 | c.JSON(http.StatusOK, resp) 56 | } 57 | 58 | func (kch *K8sClusterHandler) Delete(c *gin.Context) { 59 | id := strings.TrimSpace(c.Param("id")) 60 | idInt, _ := strconv.Atoi(id) 61 | 62 | resp := Response{ 63 | Code: 10000, 64 | Msg: "", 65 | } 66 | 67 | k8sCluster := model.K8sCluster{ 68 | ID: uint(idInt), 69 | } 70 | 71 | err := k8sCluster.Delete() 72 | if err != nil { 73 | resp.Code = 10001 74 | resp.Msg = err.Error() 75 | } 76 | 77 | c.JSON(http.StatusOK, resp) 78 | } 79 | 80 | func (kch *K8sClusterHandler) Edit(c *gin.Context) { 81 | id := strings.TrimSpace(c.Param("id")) 82 | idInt, _ := strconv.Atoi(id) 83 | 84 | name := strings.TrimSpace(c.PostForm("Name")) 85 | resourceID := strings.TrimSpace(c.PostForm("ResourceID")) 86 | 87 | resp := Response{ 88 | Code: 10000, 89 | Msg: "", 90 | } 91 | 92 | k8sCluster := model.K8sCluster{ 93 | ID: uint(idInt), 94 | } 95 | 96 | k8sClusterData := model.K8sCluster{ 97 | Name: name, 98 | } 99 | 100 | err := k8sCluster.Edit(k8sClusterData, resourceID) 101 | if err != nil { 102 | resp.Code = 10001 103 | resp.Msg = err.Error() 104 | } 105 | 106 | c.JSON(http.StatusOK, resp) 107 | } 108 | 109 | func (kch *K8sClusterHandler) Get(c *gin.Context) { 110 | id := strings.TrimSpace(c.Param("id")) 111 | idInt, _ := strconv.Atoi(id) 112 | 113 | resp := Response{ 114 | Code: 10000, 115 | Msg: "", 116 | } 117 | 118 | k8sCluster := model.K8sCluster{ 119 | ID: uint(idInt), 120 | } 121 | 122 | r, err := k8sCluster.Get() 123 | if err == nil { 124 | resp.Data = r 125 | } else { 126 | resp.Code = 10001 127 | resp.Msg = err.Error() 128 | } 129 | 130 | c.JSON(http.StatusOK, resp) 131 | } 132 | -------------------------------------------------------------------------------- /sysbase/backend/handler/k8sclusterresource.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | "strconv" 6 | "strings" 7 | 8 | "github.com/gin-gonic/gin" 9 | 10 | "sysbase/model" 11 | ) 12 | 13 | type K8sClusterResourceHandler struct{} 14 | 15 | func (kcrh *K8sClusterResourceHandler) ListResource(c *gin.Context) { 16 | id := strings.TrimSpace(c.Param("id")) 17 | idInt, _ := strconv.Atoi(id) 18 | 19 | resp := Response{ 20 | Code: 10000, 21 | Msg: "", 22 | } 23 | 24 | k8sClusterResource := model.K8sClusterResource{} 25 | 26 | r, err := k8sClusterResource.ListResource(uint(idInt), []string{}) 27 | if err == nil { 28 | resp.Data = r 29 | } else { 30 | resp.Code = 10001 31 | resp.Msg = err.Error() 32 | } 33 | 34 | c.JSON(http.StatusOK, resp) 35 | } 36 | -------------------------------------------------------------------------------- /sysbase/backend/handler/podresource.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | "strconv" 6 | "strings" 7 | 8 | "github.com/gin-gonic/gin" 9 | 10 | "sysbase/model" 11 | ) 12 | 13 | type PodResourceHandler struct{} 14 | 15 | func (prh *PodResourceHandler) ListResource(c *gin.Context) { 16 | id := strings.TrimSpace(c.Param("id")) 17 | idInt, _ := strconv.Atoi(id) 18 | 19 | resp := Response{ 20 | Code: 10000, 21 | Msg: "", 22 | } 23 | 24 | podResource := model.PodResource{} 25 | 26 | r, err := podResource.ListResource(uint(idInt)) 27 | if err == nil { 28 | resp.Data = r 29 | } else { 30 | resp.Code = 10001 31 | resp.Msg = err.Error() 32 | } 33 | 34 | c.JSON(http.StatusOK, resp) 35 | } 36 | -------------------------------------------------------------------------------- /sysbase/backend/handler/response.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | type ( 4 | Response struct { 5 | Code int `json:"Code"` 6 | Msg string `json:"Msg"` 7 | Data interface{} `json:"Data"` 8 | } 9 | ) 10 | -------------------------------------------------------------------------------- /sysbase/backend/handler/tenantpod.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | "strconv" 6 | "strings" 7 | 8 | "github.com/gin-gonic/gin" 9 | 10 | "sysbase/model" 11 | ) 12 | 13 | type TenantPodHandler struct{} 14 | 15 | func (tph *TenantPodHandler) Open(c *gin.Context) { 16 | tenantID := strings.TrimSpace(c.PostForm("tenantID")) 17 | podID := strings.TrimSpace(c.PostForm("podID")) 18 | tenantName := strings.TrimSpace(c.PostForm("tenantName")) 19 | tenantIDInt, _ := strconv.Atoi(tenantID) 20 | podIDInt, _ := strconv.Atoi(podID) 21 | 22 | resp := Response{ 23 | Code: 10000, 24 | Msg: "", 25 | } 26 | 27 | tenantPod := model.TenantPod{ 28 | TenantID: uint(tenantIDInt), 29 | PodID: uint(podIDInt), 30 | TenantName: tenantName, 31 | } 32 | 33 | r, err := tenantPod.Insert() 34 | if err == nil { 35 | resp.Data = r 36 | } else { 37 | resp.Code = 10001 38 | resp.Msg = err.Error() 39 | } 40 | 41 | c.JSON(http.StatusOK, resp) 42 | } 43 | 44 | func (tph *TenantPodHandler) GetByTenantID(c *gin.Context) { 45 | tenantID := strings.TrimSpace(c.Param("tenantID")) 46 | tenantIDInt, _ := strconv.Atoi(tenantID) 47 | 48 | resp := Response{ 49 | Code: 10000, 50 | Msg: "", 51 | } 52 | 53 | tenantPod := model.TenantPod{ 54 | TenantID: uint(tenantIDInt), 55 | } 56 | 57 | r, err := tenantPod.Get() 58 | if err == nil { 59 | resp.Data = r 60 | } else { 61 | resp.Code = 10001 62 | resp.Msg = err.Error() 63 | } 64 | 65 | c.JSON(http.StatusOK, resp) 66 | } 67 | -------------------------------------------------------------------------------- /sysbase/backend/installk8s/common.go: -------------------------------------------------------------------------------- 1 | package installk8s 2 | 3 | import "fmt" 4 | 5 | func getModifyDnsCmds(cmds []string, pridnsHost string) []string { 6 | // 匹配添加私有DNS配置,确保在匹配行的上面只添加一行,并且不重复添加 7 | cmd1 := fmt.Sprintf(`grep "%s" /etc/resolv.conf > /dev/null 2>&1 || (cp -rp /etc/resolv.conf /tmp/resolv.conf && awk 'BEGIN{d=0};{ if($0 ~ /nameserver / && d==0) {d=1; printf("nameserver %s\n%%s\n", $0)} else {print $0}}' /tmp/resolv.conf > /etc/resolv.conf && rm -rf /tmp/resolv.conf)`, pridnsHost, pridnsHost) 8 | 9 | // 修改网卡配置文件,添加DNS,避免重启后DNS丢失 10 | cmd2 := fmt.Sprintf(`file=$(grep -rl ^DNS $(ls /etc/sysconfig/network-scripts/ifcfg-*)) && (grep "DNS1=%s" $file > /dev/null 2>&1 || (DNS=$(echo DNS1=%s && cat $file | grep ^DNS | awk -F '=' '{print "DNS"(NR+1)"="$2}' && sed -i '/^DNS.*/d' $file); echo "$DNS" >> $file))`, pridnsHost, pridnsHost) 11 | 12 | return append(cmds, cmd1, cmd2) 13 | } 14 | -------------------------------------------------------------------------------- /sysbase/backend/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | "net" 7 | "os" 8 | "runtime" 9 | 10 | "github.com/spf13/pflag" 11 | 12 | "sysbase/args" 13 | "sysbase/config" 14 | "sysbase/server" 15 | "sysbase/version" 16 | ) 17 | 18 | var ( 19 | argConfigFile = pflag.String("config", "etc/config.yaml", "sysbase config file.") 20 | argVersion = pflag.Bool("version", false, "The version of sysbase.") 21 | 22 | argPort = pflag.Int("port", 8081, "The secure port to listen to for incoming HTTPS requests.") 23 | argBindAddress = pflag.IP("bind-address", net.IPv4(0, 0, 0, 0), "The IP address on which to serve the --port (set to 0.0.0.0 for all interfaces).") 24 | ) 25 | 26 | func init() { 27 | // Set logging output to standard console out 28 | log.SetOutput(os.Stdout) 29 | 30 | pflag.CommandLine.AddGoFlagSet(flag.CommandLine) 31 | pflag.Parse() 32 | _ = flag.CommandLine.Parse(make([]string, 0)) // Init for glog calls in kubernetes packages 33 | } 34 | 35 | func main() { 36 | if *argVersion { 37 | log.Println(version.VersionInfo()) 38 | return 39 | } 40 | log.Println(version.VersionInfo()) 41 | 42 | runtime.GOMAXPROCS(runtime.NumCPU()) 43 | 44 | // log.Printf("Git commit:%s\n", hack.Version) 45 | // log.Printf("Build time:%s\n", hack.Compile) 46 | 47 | if *argVersion { 48 | return 49 | } 50 | 51 | if len(*argConfigFile) == 0 { 52 | log.Fatalln("Must use a config file") 53 | } 54 | 55 | c := &config.Config{} 56 | err := c.ReadConfigFile(*argConfigFile) 57 | if err != nil { 58 | log.Fatalf("Read config file error:%v\n", err.Error()) 59 | } 60 | 61 | initArgHolder(c) 62 | 63 | s := server.NewServer(c) 64 | s.Run() 65 | } 66 | 67 | /** 68 | * Lookup the environment variable provided and set to default value if variable isn't found 69 | */ 70 | func getEnv(key, fallback string) string { 71 | value := os.Getenv(key) 72 | if value == "" { 73 | value = fallback 74 | } 75 | return value 76 | } 77 | 78 | func initArgHolder(c *config.Config) { 79 | builder := args.GetHolderBuilder() 80 | builder.SetPort(*argPort) 81 | builder.SetBindAddress(*argBindAddress) 82 | } 83 | -------------------------------------------------------------------------------- /sysbase/backend/model/k8scluster.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "strconv" 5 | "strings" 6 | ) 7 | 8 | // 设置K8sClusters表字段 9 | type K8sCluster struct { 10 | ID uint `gorm:"primaryKey;autoIncrement;comment:自增ID"` 11 | Name string `gorm:"type:varchar(255);not null;default:'';comment:集群名称"` 12 | UpdatedAt int64 `gorm:"autoUpdateTime:milli"` 13 | CreatedAt int64 `gorm:"autoCreateTime:milli"` 14 | } 15 | 16 | func (kc K8sCluster) InitTable() error { 17 | // 设置表信息 18 | //migrator := DBConn[DBName].Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='K8sClusters表'").Migrator() 19 | migrator := DBConn[DBName].Set("gorm:table_options", "").Migrator() 20 | 21 | // 判断表是否存在 22 | if migrator.HasTable(&K8sCluster{}) { 23 | // 存在就自动适配表,也就说原先没字段的就增加字段 24 | return migrator.AutoMigrate(&K8sCluster{}) 25 | } 26 | 27 | // 不存在就创建新表 28 | return migrator.CreateTable(&K8sCluster{}) 29 | } 30 | 31 | func (kc K8sCluster) Insert(resourceID string) (K8sCluster, error) { 32 | tx := DBConn[DBName].Create(&kc) 33 | err := tx.Error 34 | if err == nil { 35 | kc.K8sClusterResourceInsert(resourceID) 36 | } 37 | return kc, err 38 | } 39 | 40 | func (kc K8sCluster) List() ([]K8sCluster, error) { 41 | var kcs []K8sCluster 42 | result := DBConn[DBName].Order("id desc").Find(&kcs) 43 | return kcs, result.Error 44 | } 45 | 46 | func (kc K8sCluster) Delete() error { 47 | tx := DBConn[DBName].Delete(&kc) 48 | return tx.Error 49 | } 50 | 51 | func (kc K8sCluster) Edit(kcData K8sCluster, resourceID string) error { 52 | tx := DBConn[DBName].Model(&kc) 53 | if tx.Error != nil { 54 | return tx.Error 55 | } 56 | 57 | err := tx.Updates(kcData).Error 58 | if err == nil { 59 | kc.K8sClusterResourceInsert(resourceID) 60 | } 61 | return err 62 | } 63 | 64 | func (kc K8sCluster) K8sClusterResourceInsert(resourceID string) { 65 | resourceIDArr := strings.Split(resourceID, ",") 66 | for _, rID := range resourceIDArr { 67 | rIDInt, _ := strconv.Atoi(rID) 68 | if rIDInt <= 0 { 69 | continue 70 | } 71 | kcr := K8sClusterResource{ 72 | K8sClusterID: kc.ID, 73 | ResourceID: uint(rIDInt), 74 | } 75 | kcr.Insert() 76 | } 77 | } 78 | 79 | func (kc K8sCluster) Get() (K8sCluster, error) { 80 | var kcData K8sCluster 81 | err := DBConn[DBName].Where(&kc).Find(&kcData).Error 82 | return kcData, err 83 | } 84 | -------------------------------------------------------------------------------- /sysbase/backend/model/model.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import ( 4 | "errors" 5 | "fmt" 6 | 7 | "gorm.io/driver/sqlite" 8 | "gorm.io/gorm" 9 | "gorm.io/gorm/schema" 10 | 11 | "sysbase/config" 12 | ) 13 | 14 | type Model interface { 15 | InitTable() error 16 | } 17 | 18 | var ( 19 | _ Model = Pod{} 20 | _ Model = Resource{} 21 | _ Model = K8sCluster{} 22 | _ Model = K8sClusterResource{} 23 | _ Model = PodResource{} 24 | _ Model = TenantPod{} 25 | 26 | DBConn map[string]*gorm.DB 27 | ) 28 | 29 | const DBName = "sysbase" 30 | 31 | func InitDB(dbs config.Db) error { 32 | 33 | DBConn = make(map[string]*gorm.DB) 34 | for _, db := range dbs { 35 | switch db.Type { 36 | case "sqlite": 37 | if len(db.Dsn) == 0 { 38 | return errors.New(fmt.Sprintf("%s 数据库配置为空", db.Name)) 39 | } 40 | var err error 41 | conn, err := gorm.Open(sqlite.Open(db.Dsn), &gorm.Config{ 42 | NamingStrategy: schema.NamingStrategy{ 43 | TablePrefix: db.TablePrefix, 44 | SingularTable: true, 45 | }, 46 | }) 47 | if err != nil { 48 | return err 49 | } 50 | 51 | sqlDB, err := conn.DB() 52 | if err != nil { 53 | return err 54 | } 55 | 56 | // 设置打开数据库连接的最大数量 57 | sqlDB.SetMaxOpenConns(db.MaxOpenConns) 58 | 59 | DBConn[db.Name] = conn 60 | break 61 | } 62 | } 63 | 64 | _ = Resource{}.InitTable() 65 | _ = K8sCluster{}.InitTable() 66 | _ = Pod{}.InitTable() 67 | _ = K8sClusterResource{}.InitTable() 68 | _ = PodResource{}.InitTable() 69 | _ = TenantPod{}.InitTable() 70 | 71 | return nil 72 | } 73 | -------------------------------------------------------------------------------- /sysbase/backend/model/podresource.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | // 设置PodResource表字段 4 | type PodResource struct { 5 | ID uint `gorm:"primaryKey;autoIncrement;comment:自增ID"` 6 | PodID uint `gorm:"not null;default:0;index:idx_pod_resource,unique;comment:PodID"` 7 | ResourceID uint `gorm:"not null;default:0;index:idx_pod_resource,unique;comment:ResourceID,该资源可以被多个Pod使用,比如mysql资源是可以被不同的Pod共用的,PodID和ResourceID唯一"` 8 | UpdatedAt int64 `gorm:"autoUpdateTime:milli"` 9 | CreatedAt int64 `gorm:"autoCreateTime:milli"` 10 | Pod Pod `gorm:"foreignKey:PodID;references:ID;constraint:OnDelete:NO ACTION,OnUpdate:NO ACTION"` 11 | Resource Resource `gorm:"foreignKey:ResourceID;references:ID;constraint:OnDelete:NO ACTION,OnUpdate:NO ACTION"` 12 | } 13 | 14 | func (pr PodResource) InitTable() error { 15 | // 设置表信息 16 | //migrator := DBConn[DBName].Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='PodResources表'").Migrator() 17 | migrator := DBConn[DBName].Set("gorm:table_options", "").Migrator() 18 | 19 | // 判断表是否存在 20 | if migrator.HasTable(&PodResource{}) { 21 | // 存在就自动适配表,也就说原先没字段的就增加字段 22 | return migrator.AutoMigrate(&PodResource{}) 23 | } 24 | 25 | // 不存在就创建新表 26 | return migrator.CreateTable(&PodResource{}) 27 | } 28 | 29 | func (pr PodResource) Insert() (PodResource, error) { 30 | tx := DBConn[DBName].Create(&pr) 31 | return pr, tx.Error 32 | } 33 | 34 | func (pr PodResource) List() ([]PodResource, error) { 35 | var prs []PodResource 36 | result := DBConn[DBName].Order("id desc").Find(&prs) 37 | return prs, result.Error 38 | } 39 | 40 | func (pr PodResource) Delete() error { 41 | tx := DBConn[DBName].Delete(&pr) 42 | return tx.Error 43 | } 44 | 45 | func (pr PodResource) Edit(prData PodResource) error { 46 | tx := DBConn[DBName].Model(&pr) 47 | if tx.Error != nil { 48 | return tx.Error 49 | } 50 | 51 | return tx.Updates(prData).Error 52 | } 53 | 54 | func (pr PodResource) ListResource(id uint) ([]Resource, error) { 55 | var rs []Resource 56 | 57 | tx := DBConn[DBName].Model(&pr). 58 | Select("resource.*"). 59 | Joins("left join resource on pod_resource.resource_id = resource.id"). 60 | Where("resource.category != ? and pod_resource.pod_id = ?", "vps", id). 61 | Order("resource.id desc"). 62 | Scan(&rs) 63 | return rs, tx.Error 64 | } 65 | -------------------------------------------------------------------------------- /sysbase/backend/model/tenantpod.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | // 设置TenantPod表字段 4 | type TenantPod struct { 5 | ID uint `gorm:"tpimaryKey;autoIncrement;comment:自增ID"` 6 | TenantID uint `gorm:"not null;default:0;index:idx_tenant_pod,unique;comment:租户ID"` 7 | PodID uint `gorm:"not null;default:0;index:idx_tenant_pod,unique;comment:PodID,和TenantID一起作为唯一索引"` 8 | TenantName string `gorm:"type:varchar(127);not null;default:'';comment:租户名称"` 9 | UpdatedAt int64 `gorm:"autoUpdateTime:milli"` 10 | CreatedAt int64 `gorm:"autoCreateTime:milli"` 11 | Pod Pod `gorm:"foreignKey:PodID;references:ID;constraint:OnDelete:NO ACTION,OnUpdate:NO ACTION"` 12 | } 13 | 14 | func (tp TenantPod) InitTable() error { 15 | // 设置表信息 16 | //migrator := DBConn[DBName].Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='TenantPods表'").Migrator() 17 | migrator := DBConn[DBName].Set("gorm:table_options", "").Migrator() 18 | 19 | // 判断表是否存在 20 | if migrator.HasTable(&TenantPod{}) { 21 | // 存在就自动适配表,也就说原先没字段的就增加字段 22 | return migrator.AutoMigrate(&TenantPod{}) 23 | } 24 | 25 | // 不存在就创建新表 26 | return migrator.CreateTable(&TenantPod{}) 27 | } 28 | 29 | func (tp TenantPod) Insert() (TenantPod, error) { 30 | tx := DBConn[DBName].Create(&tp) 31 | return tp, tx.Error 32 | } 33 | 34 | func (tp TenantPod) List() ([]TenantPod, error) { 35 | var tps []TenantPod 36 | result := DBConn[DBName].Order("id desc").Find(&tps) 37 | return tps, result.Error 38 | } 39 | 40 | func (tp TenantPod) Delete() error { 41 | tx := DBConn[DBName].Delete(&tp) 42 | return tx.Error 43 | } 44 | 45 | func (tp TenantPod) Edit(tpData TenantPod) error { 46 | tx := DBConn[DBName].Model(&tp) 47 | if tx.Error != nil { 48 | return tx.Error 49 | } 50 | 51 | return tx.Updates(tpData).Error 52 | } 53 | 54 | func (tp TenantPod) Get() (TenantPod, error) { 55 | var tpData TenantPod 56 | err := DBConn[DBName].Where(&tp).Find(&tpData).Error 57 | return tpData, err 58 | } 59 | -------------------------------------------------------------------------------- /sysbase/backend/router/middleware/auth/auth.go: -------------------------------------------------------------------------------- 1 | package auth 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | ) 6 | 7 | // 认证中间件 8 | func Auth() gin.HandlerFunc { 9 | return func(c *gin.Context) { 10 | 11 | c.Next() 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sysbase/backend/router/middleware/cors/cors.go: -------------------------------------------------------------------------------- 1 | package cors 2 | 3 | import ( 4 | "net/http" 5 | "strings" 6 | 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | // 跨域Option支持中间件 11 | func Cors() gin.HandlerFunc { 12 | return func(c *gin.Context) { 13 | c.Writer.Header().Set("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE, OPTIONS") 14 | c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, Accept, Origin, Cache-Control, X-Requested-With, User-Agent, jweToken") 15 | 16 | if !strings.Contains(c.Request.URL.Path, "/kubeapi/sockjs") { 17 | c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") 18 | } 19 | 20 | origin := c.Request.Header.Get("Origin") 21 | // if IsOriginOk(origin) { 22 | c.Writer.Header().Set("Access-Control-Allow-Origin", origin) 23 | // } 24 | 25 | if c.Request.Method == "OPTIONS" { 26 | c.AbortWithStatus(http.StatusNoContent) 27 | } 28 | } 29 | } 30 | 31 | func JsonHeader() gin.HandlerFunc { 32 | return func(c *gin.Context) { 33 | c.Writer.Header().Set("Content-Type", "application/json") 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /sysbase/backend/server/unix.go: -------------------------------------------------------------------------------- 1 | //go:build darwin || freebsd || linux || netbsd || openbsd 2 | // +build darwin freebsd linux netbsd openbsd 3 | 4 | package server 5 | 6 | import ( 7 | "fmt" 8 | "log" 9 | "syscall" 10 | 11 | "github.com/fvbock/endless" 12 | 13 | //"gopkg.in/gin-contrib/pprof.v1" 14 | 15 | "sysbase/args" 16 | "sysbase/config" 17 | "sysbase/model" 18 | "sysbase/router" 19 | ) 20 | 21 | type Server struct { 22 | config *config.Config 23 | } 24 | 25 | func NewServer(c *config.Config) *Server { 26 | s := &Server{ 27 | config: c, 28 | } 29 | return s 30 | } 31 | 32 | func (s *Server) Run() error { 33 | // 连接数据库 34 | model.InitDB(s.config.Db) 35 | 36 | // 初始化路由 37 | router := router.InitRouter(s.config) 38 | 39 | /* 40 | pprof.Register(router, &pprof.Options{ 41 | // default is "debug/pprof" 42 | RoutePrefix: "debug/pprof", 43 | }) 44 | */ 45 | 46 | // 平滑重启 47 | /* 48 | kill -SIGHUP 2591 will trigger a fork/restart 49 | kill -SIGINT[SIGTERM] 2591 will trigger a shutdown of the server (it will finish running requests) 50 | */ 51 | server := endless.NewServer(fmt.Sprintf("%s:%d", args.Holder.GetBindAddress(), args.Holder.GetPort()), router) 52 | server.BeforeBegin = func(add string) { 53 | log.Printf("Actual pid is %d\n", syscall.Getpid()) 54 | // save it somehow 55 | } 56 | err := server.ListenAndServe() 57 | if err != nil { 58 | log.Println(err) 59 | } 60 | 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /sysbase/backend/server/windows.go: -------------------------------------------------------------------------------- 1 | //go:build windows 2 | // +build windows 3 | 4 | package server 5 | 6 | import ( 7 | "fmt" 8 | 9 | //"gopkg.in/gin-contrib/pprof.v1" 10 | 11 | "sysbase/args" 12 | "sysbase/config" 13 | "sysbase/model" 14 | "sysbase/router" 15 | ) 16 | 17 | type Server struct { 18 | config *config.Config 19 | } 20 | 21 | func NewServer(c *config.Config) *Server { 22 | s := &Server{ 23 | config: c, 24 | } 25 | return s 26 | } 27 | 28 | func (s *Server) Run() error { 29 | // 连接数据库 30 | model.InitDB(s.config.Db) 31 | 32 | // 初始化路由 33 | router := router.InitRouter(s.config) 34 | 35 | router.Run(fmt.Sprintf("%s:%d", args.Holder.GetBindAddress(), args.Holder.GetPort())) 36 | 37 | return nil 38 | } 39 | -------------------------------------------------------------------------------- /sysbase/backend/tool/hello/hello.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func indexHandler(w http.ResponseWriter, r *http.Request) { 9 | w.Header().Set("Content-Type", "text/html; charset=utf-8") 10 | w.WriteHeader(http.StatusOK) 11 | fmt.Fprintf(w, "

欢迎使用稳定安全的k8s系统!

") 12 | } 13 | 14 | func main() { 15 | http.HandleFunc("/", indexHandler) 16 | http.ListenAndServe(":80", nil) 17 | } 18 | -------------------------------------------------------------------------------- /sysbase/backend/tool/updatesecret/go.mod: -------------------------------------------------------------------------------- 1 | module updatesecret 2 | 3 | go 1.15 4 | 5 | replace updatesecret => ./updatesecret 6 | 7 | require ( 8 | github.com/spf13/pflag v1.0.5 9 | gopkg.in/square/go-jose.v2 v2.6.0 10 | k8s.io/api v0.27.1 11 | k8s.io/apimachinery v0.27.1 12 | k8s.io/apiserver v0.27.1 13 | k8s.io/client-go v0.27.1 14 | k8s.io/component-base v0.27.1 15 | k8s.io/klog/v2 v2.90.1 16 | ) 17 | -------------------------------------------------------------------------------- /sysbase/backend/tool/updatesecret/serviceaccount/metrics.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2020 The Kubernetes Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package serviceaccount 18 | 19 | import ( 20 | "sync" 21 | 22 | "k8s.io/component-base/metrics" 23 | "k8s.io/component-base/metrics/legacyregistry" 24 | ) 25 | 26 | const kubeServiceAccountSubsystem = "serviceaccount" 27 | 28 | var ( 29 | // LegacyTokensTotal is the number of legacy tokens used against apiserver. 30 | legacyTokensTotal = metrics.NewCounter( 31 | &metrics.CounterOpts{ 32 | Subsystem: kubeServiceAccountSubsystem, 33 | Name: "legacy_tokens_total", 34 | Help: "Cumulative legacy service account tokens used", 35 | StabilityLevel: metrics.ALPHA, 36 | }, 37 | ) 38 | 39 | // StaleTokensTotal is the number of stale projected tokens not refreshed on 40 | // client side. 41 | staleTokensTotal = metrics.NewCounter( 42 | &metrics.CounterOpts{ 43 | Subsystem: kubeServiceAccountSubsystem, 44 | Name: "stale_tokens_total", 45 | Help: "Cumulative stale projected service account tokens used", 46 | StabilityLevel: metrics.ALPHA, 47 | }, 48 | ) 49 | 50 | // ValidTokensTotal is the number of valid projected tokens used. 51 | validTokensTotal = metrics.NewCounter( 52 | &metrics.CounterOpts{ 53 | Subsystem: kubeServiceAccountSubsystem, 54 | Name: "valid_tokens_total", 55 | Help: "Cumulative valid projected service account tokens used", 56 | StabilityLevel: metrics.ALPHA, 57 | }, 58 | ) 59 | ) 60 | 61 | var registerMetricsOnce sync.Once 62 | 63 | func RegisterMetrics() { 64 | registerMetricsOnce.Do(func() { 65 | legacyregistry.MustRegister(legacyTokensTotal) 66 | legacyregistry.MustRegister(staleTokensTotal) 67 | legacyregistry.MustRegister(validTokensTotal) 68 | }) 69 | } 70 | -------------------------------------------------------------------------------- /sysbase/backend/tool/waitoutput/waitoutput.go: -------------------------------------------------------------------------------- 1 | package waitoutput 2 | 3 | import "sync" 4 | 5 | type message struct { 6 | cmd string 7 | data chan string 8 | } 9 | 10 | type WaitOutput struct { 11 | sync.RWMutex 12 | Num int 13 | Message []*message 14 | Cmds []string 15 | } 16 | 17 | func (wo *WaitOutput) SetDataChan(cmd string) { 18 | wo.Lock() 19 | defer wo.Unlock() 20 | 21 | has := false 22 | for _, v := range wo.Message { 23 | if v.cmd == cmd { 24 | has = true 25 | } 26 | } 27 | if !has { 28 | m := &message{ 29 | cmd: cmd, 30 | data: make(chan string, 1), 31 | } 32 | wo.Num = wo.Num + 1 33 | wo.Message = append(wo.Message, m) 34 | wo.Cmds = append(wo.Cmds, cmd) 35 | } 36 | } 37 | 38 | func (wo *WaitOutput) GetDataChan(cmd string) chan string { 39 | wo.RLock() 40 | defer wo.RUnlock() 41 | 42 | for _, v := range wo.Message { 43 | if v.cmd == cmd { 44 | return v.data 45 | } 46 | } 47 | return nil 48 | } 49 | 50 | func (wo *WaitOutput) IsRunning(cmd string) bool { 51 | wo.RLock() 52 | defer wo.RUnlock() 53 | 54 | for _, v := range wo.Message { 55 | if v.cmd == cmd { 56 | return true 57 | } 58 | } 59 | return false 60 | } 61 | 62 | func (wo *WaitOutput) DeleteByCmd(cmd string) { 63 | wo.Lock() 64 | defer wo.Unlock() 65 | 66 | var ms []*message 67 | has := false 68 | for _, v := range wo.Message { 69 | if v.cmd == cmd { 70 | has = true 71 | if !isStringChanClosed(v.data) { 72 | close(v.data) 73 | } 74 | } else { 75 | ms = append(ms, v) 76 | } 77 | } 78 | if has && wo.Num > 0 { 79 | wo.Message = ms 80 | wo.Cmds = append(wo.Cmds[:wo.Num-1], wo.Cmds[wo.Num:]...) 81 | wo.Num = wo.Num - 1 82 | } 83 | } 84 | 85 | func isStringChanClosed(ch <-chan string) bool { 86 | select { 87 | case <-ch: 88 | return true 89 | default: 90 | } 91 | 92 | return false 93 | } 94 | -------------------------------------------------------------------------------- /sysbase/backend/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | var ( 8 | Pkg = "" 9 | Version = "" 10 | GitCommitSha = "" 11 | GitCommitTime = "" 12 | BuildTime = "" 13 | ) 14 | 15 | func VersionInfo() string { 16 | return fmt.Sprintf("Sysbase git:%s, version:%s, commit-sha:%s, commit-time:%s, build-time:%s", Pkg, Version, GitCommitSha, GitCommitTime, BuildTime) 17 | } 18 | -------------------------------------------------------------------------------- /sysbase/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /sysbase/frontend/README.md: -------------------------------------------------------------------------------- 1 | # sysbase 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | yarn lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /sysbase/frontend/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /sysbase/frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sysbase", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.21.1", 12 | "core-js": "^3.6.5", 13 | "element-ui": "^2.4.5", 14 | "js-yaml": "^3.14.1", 15 | "moment": "^2.29.1", 16 | "vue": "^2.6.11", 17 | "vue-router": "^3.2.0", 18 | "vue2-ace-editor": "^0.0.15", 19 | "vuex": "^3.4.0", 20 | "xterm": "^4.16.0", 21 | "xterm-addon-fit": "^0.5.0" 22 | }, 23 | "devDependencies": { 24 | "@vue/cli-plugin-babel": "~4.5.0", 25 | "@vue/cli-plugin-eslint": "~4.5.0", 26 | "@vue/cli-plugin-router": "~4.5.0", 27 | "@vue/cli-plugin-vuex": "~4.5.0", 28 | "@vue/cli-service": "~4.5.0", 29 | "babel-eslint": "^10.1.0", 30 | "eslint": "^6.7.2", 31 | "eslint-plugin-vue": "^6.2.2", 32 | "node-sass": "^4.9.2", 33 | "sass": "^1.26.5", 34 | "sass-loader": "^8.0.2", 35 | "vue-cli-plugin-element": "~1.0.1", 36 | "vue-template-compiler": "^2.6.11" 37 | }, 38 | "eslintConfig": { 39 | "root": true, 40 | "env": { 41 | "node": true 42 | }, 43 | "extends": [ 44 | "plugin:vue/essential", 45 | "eslint:recommended" 46 | ], 47 | "parserOptions": { 48 | "parser": "babel-eslint" 49 | }, 50 | "rules": {} 51 | }, 52 | "browserslist": [ 53 | "> 1%", 54 | "last 2 versions", 55 | "not dead" 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /sysbase/frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/sysbase/frontend/public/favicon.ico -------------------------------------------------------------------------------- /sysbase/frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | <% if(htmlWebpackPlugin.options.env !== 'development') { %> 10 | 13 | <% } %> 14 | 15 | 16 | 19 |
20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sysbase/frontend/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 27 | -------------------------------------------------------------------------------- /sysbase/frontend/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yonyoucloud/install_k8s/82211f4a7c12dac35ec6a21fbdd9bc5fc11aec91/sysbase/frontend/src/assets/logo.png -------------------------------------------------------------------------------- /sysbase/frontend/src/components/AceEditor.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /sysbase/frontend/src/element-variables.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Write your variables here. All available variables can be 3 | found in element-ui/packages/theme-chalk/src/common/var.scss. 4 | For example, to overwrite the theme color: 5 | */ 6 | $--color-primary: teal; 7 | 8 | /* icon font path, required */ 9 | $--font-path: '~element-ui/lib/theme-chalk/fonts'; 10 | 11 | @import "~element-ui/packages/theme-chalk/src/index"; 12 | -------------------------------------------------------------------------------- /sysbase/frontend/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import './plugins/element.js' 6 | 7 | Vue.config.productionTip = false 8 | 9 | new Vue({ 10 | router, 11 | store, 12 | render: h => h(App) 13 | }).$mount('#app') 14 | -------------------------------------------------------------------------------- /sysbase/frontend/src/plugins/element.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Element from 'element-ui' 3 | import '../element-variables.scss' 4 | 5 | Vue.use(Element) 6 | -------------------------------------------------------------------------------- /sysbase/frontend/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Home from '../views/Home.vue' 4 | 5 | Vue.use(VueRouter) 6 | 7 | const routes = [ 8 | { 9 | path: '/', 10 | name: 'Home', 11 | component: Home 12 | }, 13 | { 14 | path: '/about', 15 | name: 'About', 16 | // route level code-splitting 17 | // this generates a separate chunk (about.[hash].js) for this route 18 | // which is lazy-loaded when the route is visited. 19 | component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') 20 | } 21 | ] 22 | 23 | const router = new VueRouter({ 24 | mode: 'history', 25 | base: process.env.BASE_URL, 26 | routes 27 | }) 28 | 29 | export default router 30 | -------------------------------------------------------------------------------- /sysbase/frontend/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex) 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | }, 9 | mutations: { 10 | }, 11 | actions: { 12 | }, 13 | modules: { 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /sysbase/frontend/src/tools/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | 3 | // create an axios instance 4 | const baseURL = window.CONFIG && window.CONFIG.apiHost || 'http://127.0.0.1:8081/' 5 | const request = axios.create({ 6 | baseURL: baseURL, 7 | withCredentials: true, // 跨域请求时发送 cookies 8 | timeout: 10000 // request timeout 9 | }) 10 | 11 | // request interceptor 12 | request.interceptors.request.use( 13 | config => { 14 | config.headers['jweToken'] = 'ABCD' 15 | return config 16 | }, 17 | error => { 18 | // Do something with request error 19 | // console.log(888, error) // for debug 20 | Promise.reject(error) 21 | } 22 | ) 23 | 24 | // response interceptor 25 | request.interceptors.response.use( 26 | response => { 27 | return response.data 28 | }, 29 | error => { 30 | console.log('err: ' + error) // for debug 31 | if (axios.isCancel(error)) { 32 | throw new Error('request has been cancelled') 33 | } 34 | return Promise.reject(error) 35 | } 36 | ) 37 | 38 | export default request -------------------------------------------------------------------------------- /sysbase/frontend/src/tools/stream.js: -------------------------------------------------------------------------------- 1 | const baseURL = window.CONFIG && window.CONFIG.apiHost || 'http://127.0.0.1:8081/' 2 | 3 | export function stream(url) { 4 | return new EventSource(baseURL + url) 5 | } -------------------------------------------------------------------------------- /sysbase/frontend/src/views/About.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /sysbase/frontend/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 36 | 37 | 69 | -------------------------------------------------------------------------------- /sysbase/frontend/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | chainWebpack: config => { 3 | // 移除 preload 插件 4 | config.plugins.delete('preload-index') 5 | }, 6 | pages: { 7 | index: { 8 | entry: 'src/main.js', 9 | env: process.env.NODE_ENV 10 | } 11 | }, 12 | publicPath: './', 13 | assetsDir: './', 14 | } --------------------------------------------------------------------------------