k8s installation prometheus

Ready profile and image, because the image online download, you need Internet access **, yet so directly with Silicon Valley

[root@k8s-master ~]# ll
The total amount of 279 904
-rw -------. 1 root root 1731 00:07 anaconda 12, the 18-yue ks.cfg
 rw-r is - r. 1 root root 1779 12 00:11 the 18-initial-setup yue ks.cfg
 rwxr-xr-x is 1 to set a root to set a root 39305216 1 get 5 19:40 yue kubeadm
 rw-r is - to set a root to set a root r 1 1028 12月19 kubeadm 22:26 configyaml
 rw-r is - to set a root to set a root r 1 4668 12 22:20 19 And kubeadm yue initlog
 rw-r is - to set a root to set a root r 1 14416 12月19 22: kube 36 to flannelyml
 rw-r is - r. 1 root root 484 12 the 18-09:40 yue kubernetesconf
 rw-r is - to set a root to set a root r 1 of 199 1 7 And 00:57 To get started load yue images.sh
drwxr-xr-x  2 root root       315 8月   2 17:16 prometheus
-rw-r--r--  1 root root 247267436 1月   7 00:57 prometheus.tar.gz
[root@k8s-master ~]#

In the server 3 may be introduced into these mirror

[root@k8s-node02 ~]#  tar -zvxf prometheus.tar.gz
prometheus/
prometheus/addon-resizer.tar
prometheus/alertmanager.tar
prometheus/configmap-reload.tar
Prometheus / grafana.tar
prometheus/k8s-prometheus-adapter-amd64.tar
prometheus/kube-rbac-proxy.tar
prometheus/kube-state-metrics.tar
prometheus/node-exporter.tar
prometheus/prometheus-config-reloader.tar
prometheus/prometheus-operator.tar
prometheus/prometheus.tar
[root@k8s-node02 ~]# sh load-images.sh
8a788232037e: Loading layer [==================================================>]   1.37MB/1.37MB
cd05ae2f58b4: Loading layer [==================================================>]   37.2MB/37.2MB
Loaded image: k8s.gcr.io/addon-resizer:1.8.4
a724badf61ce: Loading layer [==================================================>]  1.425MB/1.425MB
a135773ab4c8: Loading layer [==================================================>]  2.627MB/2.627MB
1660e4ef8e72: Loading layer [==================================================>]  22.31MB/22.31MB
d8a26634229b: Loading layer [==================================================>]   26.9MB/26.9MB
d56a80b83a4c: Loading layer [==================================================>]  3.072kB/3.072kB
96d25d0e9121: Loading layer [==================================================>]  3.584kB/3.584kB
Loaded image: quay.io/prometheus/alertmanager:v0.18.0
91bd48b9e0b0: Loading layer [==================================================>]  4.787MB/4.787MB
5f70bf18a086: Loading layer [==================================================>]  1.024kB/1.024kB
Loaded image: quay.io/coreos/configmap-reload:v0.0.1
6270adb5794c: Loading layer [==================================================>]  58.45MB/58.45MB
9871c21d3bdf: Loading layer [==================================================>]  3.072kB/3.072kB
3e36146153a9: Loading layer [==================================================>]  24.75MB/24.75MB
4155cf44b11c: Loading layer [==================================================>]  170.5MB/170.5MB
9ed438ff1909: Loading layer [==================================================>]  196.6kB/196.6kB
0cd0d98c3ece: Loading layer [==================================================>]   5.12kB/5.12kB
Loaded image: grafana/grafana:6.2.2
7c3fbc1a45e2: Loading layer [==================================================>]  59.59MB/59.59MB
Loaded image: quay.io/coreos/k8s-prometheus-adapter-amd64:v0.4.1
e9f0f02bc156: Loading layer [==================================================>]  840.2kB/840.2kB
2ad89e029676: Loading layer [==================================================>]  36.35MB/36.35MB
Loaded image: quay.io/coreos/kube-rbac-proxy:v0.4.1
01092e5921c5: Loading layer [==================================================>]  3.062MB/3.062MB
6dc904f7f044: Loading layer [==================================================>]  31.31MB/31.31MB
f83fc93ec17d: Loading layer [==================================================>]  3.584kB/3.584kB
Loaded image: quay.io/coreos/kube-state-metrics:v1.7.1
975e03895fb7: Loading layer [==================================================>]  4.688MB/4.688MB
f9fe8137e4e3: Loading layer [==================================================>]  2.765MB/2.765MB
78f40987f0cd: Loading layer [==================================================>]  16.88MB/16.88MB
Loaded image: quay.io/prometheus/node-exporter:v0.18.1
5effb4064a9c: Loading layer [==================================================>]  7.477MB/7.477MB
0ccc317478d9: Loading layer [==================================================>]  7.477MB/7.477MB
Loaded image: quay.io/coreos/prometheus-config-reloader:v0.31.1
f02e8132e055: Loading layer [==================================================>]  37.83MB/37.83MB
Loaded image: quay.io/coreos/prometheus-operator:v0.31.1
5858aa1caa48: Loading layer [==================================================>]  76.32MB/76.32MB
495a19a962c5: Loading layer [==================================================>]  46.67MB/46.67MB
483b2ba761c7: Loading layer [==================================================>]  3.584kB/3.584kB
b1f92c6d4068: Loading layer [==================================================>]  13.31kB/13.31kB
97c86534d863: Loading layer [==================================================>]  28.16kB/28.16kB
d2cacb77d93d: Loading layer [==================================================>]  3.072kB/3.072kB
799a04338fc1: Loading layer [==================================================>]   5.12kB/5.12kB
Loaded image: quay.io/prometheus/prometheus:v2.11.0
[root@k8s-node02 ~]#

View existing mirror

[root@k8s-node02 ~]# docker images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED             SIZE
kubernetesui/dashboard                                           v2.0.0-beta8        eb51a3597525        4 weeks ago         90.8MB
busybox                                                          latest              b534869c81f0        4 weeks ago         1.22MB
perl                                                             <none>              3101c3fdee39        5 weeks ago         857MB
kubernetesui/dashboard                                           v2.0.0-beta6        84cd817d07fb        7 weeks ago         91.7MB
registry.aliyuncs.com/google_containers/kube-proxy               v1.16.0             c21b0c7400f9        3 months ago        86.1MB
perl                                                             latest              ac0fb8cfc61a        4 months ago        858MB
quay.io/coreos/kube-state-metrics                                v1.7.1              0eeea8ccba73        5 months ago        33.1MB
quay.io/prometheus/prometheus                                    v2.11.0             b97ed892eb23        6 months ago        126MB
quay.io/prometheus/alertmanager                                  v0.18.0             ce3c87f17369        6 months ago        51.9MB
quay.io/kubernetes-ingress-controller/nginx-ingress-controller   0.25.0              02149b6f439f        6 months ago        508MB
quay.io/coreos/prometheus-config-reloader                        v0.31.1             64df869d5fbe        6 months ago        17.6MB
quay.io/coreos/prometheus-operator                               v0.31.1             7b04c605e0db        6 months ago        40.5MB
grafana / grafana 6.2.2 f0e31486a3e2 7 months ago 248MB
quay.io/prometheus/node-exporter                                 v0.18.1             e5a616e4b9cf        7 months ago        22.9MB
quay.io/coreos/flannel                                           v0.11.0-amd64       ff281650a721        11 months ago       52.6MB
quay.io/coreos/kube-rbac-proxy                                   v0.4.1              70eeaa7791f2        11 months ago       41.3MB
k8s.gcr.io/kubernetes-dashboard-amd64                            v1.10.1             f9aed6605b81        12 months ago       122MB
quay.io/coreos/k8s-prometheus-adapter-amd64                      v0.4.1              9dcf4b7170ef        12 months ago       60.7MB
k8s.gcr.io/addon-resizer                                         1.8.4               5ec630648120        14 months ago       38.3MB
wangyanglinux/myapp                                              v1                  d4a5e0eaa84f        22 months ago       15.5MB
wangyanglinux/myapp                                              v3                  61f932bf5041        22 months ago       15.5MB
wangyanglinux/myapp                                              v2                  54202d3f0f35        22 months ago       15.5MB
registry.aliyuncs.com/google_containers/pause                    3.1                 da86e6ba6ca1        2 years ago         742kB
quay.io/coreos/configmap-reload                                  v0.0.1              3129a2ca29d7        3 years ago         4.79MB
[root@k8s-node02 ~]#

Extract the source on git

[@ K8S the root-Master Prometheus] # LL 
total volume of 4124 
drwxr -XR the root the root-X. 11 4096 16:02 kube-. 8 dated 2 Prometheus
 -rw-R & lt - r-- the root 4,218,009 the root. 1 at 00:45 on January 7 kube- prometheus.git.tar.gz
[root@k8s-master prometheus]#

Modify configuration files

[root@k8s-master kube-prometheus]# cd manifests
[root@k8s-master manifests]# cat grafana-service.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    app: grafana
  name: grafana
  namespace: monitoring
spec:
  type: NodePort
  ports:
  - name: http
    port: 3000
    targetPort: http
    nodePort: 30100
  selector:
    app: grafana
[root@k8s-master manifests]# cat prometheus-service.yaml
apiVersion: v1
kind: Service
metadata:
  labels:
    prometheus: k8s
  name: prometheus-k8s
  namespace: monitoring
spec:
  type: NodePort
  ports:
  - name: web
    port: 9090
    targetPort: web

start operation

[root@k8s-master manifests]# kubectl apply -f ../manifests/
namespace/monitoring unchanged
customresourcedefinition.apiextensions.k8s.io/alertmanagers.monitoring.coreos.com unchanged
customresourcedefinition.apiextensions.k8s.io/podmonitors.monitoring.coreos.com unchanged
customresourcedefinition.apiextensions.k8s.io/prometheuses.monitoring.coreos.com unchanged
customresourcedefinition.apiextensions.k8s.io/prometheusrules.monitoring.coreos.com unchanged
customresourcedefinition.apiextensions.k8s.io/servicemonitors.monitoring.coreos.com unchanged
clusterrole.rbac.authorization.k8s.io/prometheus-operator unchanged
clusterrolebinding.rbac.authorization.k8s.io/prometheus-operator unchanged
deployment.apps/prometheus-operator unchanged
service/prometheus-operator unchanged
serviceaccount/prometheus-operator unchanged
servicemonitor.monitoring.coreos.com/prometheus-operator unchanged
alertmanager.monitoring.coreos.com/main unchanged
secret/alertmanager-main unchanged
service/alertmanager-main unchanged
serviceaccount/alertmanager-main unchanged
servicemonitor.monitoring.coreos.com/alertmanager unchanged
secret/grafana-datasources unchanged
configmap/grafana-dashboard-apiserver unchanged
configmap/grafana-dashboard-controller-manager unchanged
configmap/grafana-dashboard-k8s-cluster-rsrc-use unchanged
configmap/grafana-dashboard-k8s-node-rsrc-use unchanged
configmap/grafana-dashboard-k8s-resources-cluster unchanged
configmap/grafana-dashboard-k8s-resources-namespace unchanged
configmap/grafana-dashboard-k8s-resources-pod unchanged

 

 Because my version is high, you need to change it, then start running

root@k8s-master ~]# kubectl get pod -n monitoring
NAME                                  READY   STATUS    RESTARTS   AGE
alertmanager-main-0                   2/2     Running   0          7m38s
alertmanager-main-1                   2/2     Running   0          5m43s
alertmanager-main-2                   2/2     Running   0          5m27s
grafana -54cf8d4cb8-qgwvr 1/1 Running 0           5m34s
kube-state-metrics-7cbdbbcfc5-5ls7t   4/4     Running   0          7m39s
node-exporter-k2nll                   2/2     Running   0          7m38s
node-exporter-tv55r                   2/2     Running   0          7m38s
node-exporter-vfqw6                   2/2     Running   0          7m38s
prometheus-adapter-c676d8764-d965n    1/1     Running   0          7m38s
prometheus-k8s-0                      3/3     Running   1          7m38s
prometheus-k8s-1                      3/3     Running   1          7m38s
prometheus-operator-f68bdc9b4-t2qpc   1/1     Running   0          9m24s
[root@k8s-master ~]# kubectl top node
NAME         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k8s-node01   337m         16%    1331Mi          70%
k8s-node02   307m         15%    1192Mi          63%
k8s-master   <unknown>                           <unknown>               <unknown>               <unknown>
[root@k8s-master ~]# kubectl top node
NAME         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k8s-node01   337m         16%    1325Mi          70%
k8s-node02   307m         15%    1192Mi          63%
k8s-master   <unknown>                           <unknown>               <unknown>               <unknown>
[root@k8s-master ~]# kubectl top node
NAME         CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%
k8s-master   599m         29%    1467Mi          77%
k8s-node01   365m         18%    1327Mi          70%
k8s-node02   338m         16%    1189Mi          63%

Log in to view the account password are both admin

Guess you like

Origin www.cnblogs.com/dalianpai/p/12159267.html