prometheus在k8s中的部署

2023-05-16

1.k8s的监控指标

监控指标具体实现举例
Pod性能cAdvisor容器CPU,内存利用率
Node性能node-exporter节点CPU,内存利用率
K8S资源对象kube-state-metricsPod/Deployment/Service

2.创建namespace、sa账号,在k8s集群的master节点操作

参考链接:
Kubernetes RBAC 详解
k8s部署Prometheus
如何监控k8s apiserver
#创建一个monitor-sa的名称空间

kubectl create ns monitor-sa 

#创建一个sa账号

kubectl create serviceaccount monitor -n monitor-sa  

#把sa账号monitor通过clusterrolebing绑定到clusterrole上

kubectl create clusterrolebinding monitor-clusterrolebinding -n monitor-sa --clusterrole=cluster-admin  --serviceaccount=monitor-sa:monitor

3.创建数据目录

#在k8s集群的任何一个node节点操作,因为我的k8s集群只有一个node节点node1,所以我在node1上操作如下命令:

mkdir /data/prometheus
chmod 777 /data/prometheus

4. kube-state-metric的部署

prometheus通过 sa,clusterrolebinding来解决token、证书挂载问题
sa等配置: prometheus yaml中需要配置对应的saserviceAccountName

kube-state-metrics github项目地址

.
├── cluster-role-binding.yaml
├── cluster-role.yaml
├── deployment.yaml
├── README.md
├── service-account.yaml
└── service.yaml

service-account.yaml文件

apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app.kubernetes.io/name: kube-state-metrics
    app.kubernetes.io/version: v1.8.0
  name: kube-state-metrics
  namespace: monitor-sa

cluster-role.yaml 文件

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app.kubernetes.io/name: kube-state-metrics
    app.kubernetes.io/version: v1.8.0
  name: kube-state-metrics
rules:
- apiGroups:
  - ""
  resources:
  - configmaps
  - secrets
  - nodes
  - pods
  - services
  - resourcequotas
  - replicationcontrollers
  - limitranges
  - persistentvolumeclaims
  - persistentvolumes
  - namespaces
  - endpoints
  verbs:
  - list
  - watch
- apiGroups:
  - extensions
  resources:
  - daemonsets
  - deployments
  - replicasets
  - ingresses
  verbs:
  - list
  - watch
- apiGroups:
  - apps
  resources:
  - statefulsets
  - daemonsets
  - deployments
  - replicasets
  verbs:
  - list
  - watch
- apiGroups:
  - batch
  resources:
  - cronjobs
  - jobs
  verbs:
  - list
  - watch
- apiGroups:
  - autoscaling
  resources:
  - horizontalpodautoscalers
  verbs:
  - list
  - watch
- apiGroups:
  - authentication.k8s.io
  resources:
  - tokenreviews
  verbs:
  - create
- apiGroups:
  - authorization.k8s.io
  resources:
  - subjectaccessreviews
  verbs:
  - create
- apiGroups:
  - policy
  resources:
  - poddisruptionbudgets
  verbs:
  - list
  - watch
- apiGroups:
  - certificates.k8s.io
  resources:
  - certificatesigningrequests
  verbs:
  - list
  - watch
- apiGroups:
  - storage.k8s.io
  resources:
  - storageclasses
  - volumeattachments
  verbs:
  - list
  - watch
- apiGroups:
  - admissionregistration.k8s.io
  resources:
  - mutatingwebhookconfigurations
  - validatingwebhookconfigurations
  verbs:
  - list
  - watch
- apiGroups:
  - networking.k8s.io
  resources:
  - networkpolicies
  verbs:
  - list
  - watch

cluster-role-binding.yaml

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app.kubernetes.io/name: kube-state-metrics
    app.kubernetes.io/version: v1.8.0
  name: kube-state-metrics
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: kube-state-metrics
subjects:
- kind: ServiceAccount
  name: kube-state-metrics
  namespace: monitor-sa

deployment.yaml 文件

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: kube-state-metrics
    app.kubernetes.io/version: v1.8.0
  name: kube-state-metrics
  namespace: monitor-sa
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: kube-state-metrics
  template:
    metadata:
      labels:
        app.kubernetes.io/name: kube-state-metrics
        app.kubernetes.io/version: v1.8.0
    spec:
      containers:
      - image: quay.io/coreos/kube-state-metrics:v1.8.0
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8080
          initialDelaySeconds: 5
          timeoutSeconds: 5
        name: kube-state-metrics
        ports:
        - containerPort: 8080
          name: http-metrics
        - containerPort: 8081
          name: telemetry
        readinessProbe:
          httpGet:
            path: /
            port: 8081
          initialDelaySeconds: 5
          timeoutSeconds: 5
      nodeSelector:
        kubernetes.io/os: linux
      serviceAccountName: kube-state-metrics

service.yaml文件

apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  name: kube-state-metrics
  namespace: monitor-sa
  labels:
    app: kube-state-metrics
spec:
    ports:
    - name: kube-state-metrics
      port: 8080
      protocol: TCP
    - name: telemetry
      port: 8081
      protocol: TCP
    selector:
      app.kubernetes.io/name: kube-state-metrics

5.安装prometheus,以下步骤均在在k8s集群的master节点操作

1)创建一个configmap存储卷,用来存放prometheus配置信息

kubectl get sa monitor  -n monitor-sa -o yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  creationTimestamp: "2021-05-23T14:18:14Z"
  name: monitor
  namespace: monitor-sa
  resourceVersion: "18761312"
  selfLink: /api/v1/namespaces/monitor-sa/serviceaccounts/monitor
  uid: 12ed67ab-dae8-4704-87b8-5a073a7047d2
secrets:
- name: monitor-token-p6wgp

kubectl describe sa monitor  -n monitor-sa 
Name:                monitor
Namespace:           monitor-sa
Labels:              <none>
Annotations:         <none>
Image pull secrets:  <none>
Mountable secrets:   monitor-token-p6wgp
Tokens:              monitor-token-p6wgp
Events:              <none>


kubectl describe secrets monitor-token-p6wgp -n monitor-sa 
Name:         monitor-token-p6wgp
Namespace:    monitor-sa
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: monitor
              kubernetes.io/service-account.uid: 12ed67ab-dae8-4704-87b8-5a073a7047d2

Type:  kubernetes.io/service-account-token

Data
====
ca.crt:     1025 bytes
namespace:  10 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IkY5eEJEUjZMRjNnejhxMVl6enJiYmVHX0RSOFYza1JfbVVpZmhCVXlucDQifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJtb25pdG9yLXNhIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6Im1vbml0b3ItdG9rZW4tcDZ3Z3AiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoibW9uaXRvciIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjEyZWQ2N2FiLWRhZTgtNDcwNC04N2I4LTVhMDczYTcwNDdkMiIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDptb25pdG9yLXNhOm1vbml0b3IifQ.j2hWAze7aOZgVDg0j4NKOhoMUktu7XIJ56kU_RCRbt7RCaXYd_A4ijg7IJqVUHBitQKfx-_ZzNXcOqMZt5nCN5dtToKGWRK_Du0eqepKNcsfj9dzVvebaEbd-4t7LyhHvEdf5M1CviD0wnrw1O_9nXl1COpm9IojJB9I8tIzs9Y3fiMVd2oTUL3ctFKRSkwM4CTAEIm5SZN0QRgld7Ol8W7F-m8jjOh3c7MMm9FnnAn_NkQ57XSKJovMy_AdMA55gwZaufCYA225tubG9KS0eUyF70wgGvAKOMFn6yGpRZjHj26JcBDhoEZkwzFrBM4-blnGl9pMHXtPztAPlw-xQQ

 cat    >prometheus-cfg.yaml <<EOF
---
kind: ConfigMap
apiVersion: v1
metadata:
  labels:
    app: prometheus
  name: prometheus-config
  namespace: monitor-sa
data:
  prometheus.yml: |
    global:
      scrape_interval: 15s
      scrape_timeout: 10s
      external_labels:
         monitor: 'AIUI-ceshi-k8s'
      evaluation_interval: 1m

    scrape_configs:
    - job_name: kubernetes-node
      kubernetes_sd_configs:
      - role: node
      tls_config:
        insecure_skip_verify: true
      bearer_token_file: /opt/k8s/k8s.token
      relabel_configs:
      - source_labels: [__address__]
        regex: '(.*):10250'
        replacement: '${1}:9100'
        target_label: __address__
        action: replace
      - action: labelmap
        regex: __meta_kubernetes_node_label_(.+)
      - source_labels: [instance]
        regex: .*db002.*
        action: drop

    - job_name: 'kubernetes-apiservers'
      kubernetes_sd_configs:
      - role: endpoints
      scheme: https
      tls_config:
        insecure_skip_verify: true
      bearer_token_file: /opt/k8s/k8s.token
      relabel_configs:
      - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
        action: keep
        regex: default;kubernetes;https

    - job_name: 'kube-state-metrics'
      static_configs:
      - targets: ['kube-state-metrics:8080']

    - job_name: 'kubernetes-node-cadvisor'
      kubernetes_sd_configs:
      - role:  node
      scheme: https
      tls_config:
        insecure_skip_verify: true
      bearer_token_file: /opt/k8s/k8s.token
      relabel_configs:
      - action: labelmap
        regex: __meta_kubernetes_node_label_(.+)
      - target_label: __address__
        replacement: 172.16.154.13:6443
      - source_labels: [__meta_kubernetes_node_name]
        regex: (.+)
        target_label: __metrics_path__
        replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
    
    - job_name: 'kubernetes-service-endpoints'
      scrape_timeout: 10s      
      kubernetes_sd_configs:
      - role: endpoints
      relabel_configs:
      - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
        action: keep
        regex: true
      - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
        action: replace
        target_label: __scheme__
        regex: (https?)
      - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_path]
        action: replace
        target_label: __metrics_path__
        regex: (.+)
      - source_labels: [__address__, __meta_kubernetes_service_annotation_prometheus_io_port]
        action: replace
        target_label: __address__
        regex: ([^:]+)(?::\d+)?;(\d+)
        replacement: $1:$2
      - action: labelmap
        regex: __meta_kubernetes_service_label_(.+)
      - source_labels: [__meta_kubernetes_namespace]
        action: replace
        target_label: kubernetes_namespace
      - source_labels: [__meta_kubernetes_service_name]
        action: replace
        target_label: kubernetes_name
     # - source_labels: [__meta_kubernetes_pod_container_port_number]
     #   action: replace
     #   target_label: container_port
EOF
cat >prometheus-deploy.yaml    <<EOF
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: prometheus-server
  namespace: monitor-sa
  labels:
    app: prometheus
spec:
  replicas: 1
  selector:
    matchLabels:
      app: prometheus
      component: server
  template:
    metadata:
      labels:
        app: prometheus
        component: server
      annotations:
        prometheus.io/scrape: 'false'
    spec:
      serviceAccountName: monitor
      containers:
      - name: prometheus
        image: prom/prometheus:v2.2.1
        imagePullPolicy: IfNotPresent
        command:
          - 'prometheus'
          - '--config.file=/etc/prometheus/prometheus.yml'
          - '--storage.tsdb.path=/prometheus'
          - '--storage.tsdb.retention=720h'
          - '--web.enable-lifecycle'
        ports:
        - containerPort: 9090
          protocol: TCP
        volumeMounts:
        - mountPath: /etc/prometheus/prometheus.yml
          name: prometheus-config
          subPath: prometheus.yml
        - mountPath: /prometheus/
          name: prometheus-storage-volume
        - mountPath: /opt/k8s/k8s.token
          name: k8s-token
          subPath: k8s.token
      volumes:
        - name: prometheus-config
          configMap:
            name: prometheus-config
            items:
              - key: prometheus.yml
                path: prometheus.yml
                mode: 0644
        - name: prometheus-storage-volume
          hostPath:
           path: /data/prometheus
           type: Directory
        - name: k8s-token
          hostPath:
           path: /opt/k8s
           type: Directory
cat  > prometheus-svc.yaml  <<EOF
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  name: prometheus
  namespace: monitor-sa
  labels:
    app: prometheus
spec:
  type: NodePort
  ports:
    - port: 9090
      targetPort: 9090
      nodePort: 30090
      protocol: TCP
  selector:
    app: prometheus
    component: server
EOF

在这里插入图片描述
在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

prometheus在k8s中的部署 的相关文章

  • 在 Prometheus 中添加两个值

    我们需要在 Prometheus 中添加两个查询的结果 片段如下 probe ssl earliest cert expiry job SSL expiry time lt 86400 738 1000 node time seconds
  • Prometheus基于Label的过滤

    如何在Prometheus查询中添加标签过滤器 kube pod 信息 kube pod info created by kind ReplicaSet created by name alertmanager 6d9f74d4c5 ins
  • 有没有办法使用 prometheus 监控 kube cron 作业

    有没有办法监控 kube cronjob 我有一个 kube cronjob 它在我的集群上每 10 分钟运行一次 有没有一种方法可以在每次我的 cronjob 由于某些错误而失败时收集指标 或者在我的 cronjob 在一定时间后尚未完成
  • Prometheus中将两个不同的指标分组后如何划分?

    我目前正在尝试对可用区内的 Kubernetes Pod 堆叠发出警报 我成功地使用了两种不同的指标 可以看到应用程序有多少个 pod 正在特定的可用区域上运行 但是 由于扩展 我希望警报基于百分比 因此 当某个可用区上运行特定百分比的 P
  • prometheus grafana nginx 安装配置和使用

    文章目录 前传 prometheus exporter容器 监控nginx nginx需要加载stub status监控 查看有没有 如果有 去配置下nginx 重要 需要重启nginx 测试监控是否成功 prome
  • 如何使用prometheus获取pod的CPU和内存使用百分比

    我想使用 promql Prometheus 以以下格式显示 pod 详细信息 此外 我想使用 promql 以以下格式显示应用程序 组件的 CPU 和内存利用率 promql 查询 sum container memory working
  • 如何使用 --set 来设置 Prometheus 图表的值?

    例如 设置alertmanager ingress annotations要添加两个项目 这两种方法都不起作用 helm install stable prometheus set alertmanager ingress enabled
  • 按标签过滤和选择

    如何通过选择和忽略标签来获取最新的指标 例如 以下查询 last over time application version site NYC instance Test id 1h 返回以下项目 application version i
  • 带有正则表达式的标签-普罗米修斯

    我正在尝试使用正则表达式添加新标签 名称实例是pr na01 na02 A我试图只得到pr na01 所以我这样做了 source labels meta ec2 tag Name regex target label test repla
  • Alertmanager,不同的警报规则有不同的间隔

    我正在使用alertmanager来获取prometheus指标的警报 我对不同的指标有不同的警报规则 是否可以为每个警报规则设置不同的时间间隔 例如对于metric1 我有rule1 我需要每天检查此规则间隔 对于 metric2 我有规
  • 普罗米修斯时间序列在没有更新的情况下持续多长时间

    如果我向 Prometheus 发送一个仪表 则有效负载具有时间戳和如下值 指标名称 标签 值 2 0 16239938546837 如果我在普罗米修斯上查询它 我可以看到一条连续的线 如果不发送相同指标的有效负载 线路就会停止 几分钟后发
  • Prometheus 警报管理器不发送警报 k8s

    我使用 Prometheus Operator 0 3 4 和警报管理器 0 20 但它不起作用 即我看到警报被触发 在警报选项卡上的 Prometheus UI 上 但我没有收到任何电子邮件警报 通过查看日志 我看到以下内容 知道吗 请参
  • 如何在多地点场景下配置Prometheus?

    我喜欢使用 Prometheus 进行监控和警报 到目前为止 我的所有目标 节点和容器 都与监控服务器位于同一网络上 但现在我面临一个场景 我们将应用程序堆栈 作为一堆 Docker 容器 部署到网络中的多台客户端计算机 几乎所有客户端网络
  • Prometheus AlertManager - 根据路由向不同客户端发送警报

    我有2个服务A and B我想监控 我还有 2 个不同的通知渠道X and Y形式为receivers在 AlertManager 配置文件中 我想发送通知X如果服务A出现故障并想要通知Y如果服务B下跌降落 我怎样才能实现这个我的配置 我的
  • 无法在 Spring Boot 2(版本 2.0.0.M7)中包含 Prometheus 指标

    无法在 Spring Boot 2 版本 2 0 0 M7 项目中包含 Prometheus 指标 根据千分尺文档 https micrometer io docs ref spring 2 0 prometheus added sprin
  • Prometheus 来源的时间序列:如何将空值设置为零?

    使用 Docker Grafana 8 1 5 使用时间序列图 我正在绘制Prometheus Counter来源 有一个label as a time series 按标签 并且需要将所有空 缺失值填充为零 这是应用于的查询Prometh
  • 禁用对特定主机的警报,同时对所有其他主机发出警报

    我有数百台主机向普罗米修斯服务器报告 我的每个主机有很多出口商 我希望能够列出我不希望收到警报的主机列表 我仍然需要对这些主机进行普罗米修斯监控 我尝试过匹配没有接收器的路线 这不起作用 我究竟做错了什么 或者说 我应该怎么做 我的路线规则
  • 如何使用 Prometheus Alert Manager 在 Kubernetes 中触发警报

    我在集群中设置了 kube prometheus https github com coreos prometheus operator tree master contrib kube prometheus https github co
  • PromQL:查询警报是否被静音

    我已成功消除了当前已关闭节点的警报 并且在我们有时间物理替换它之前会持续一段时间 虽然我认为沉默会阻止警报在 Slack 通道中重新出现 但我也想在我们在 Prometheus 之上运行的 Grafana 仪表板上删除它 这是对 grafa
  • 我试图根据 Prometheus 黑盒导出器的成功响应来计算 Grafana 的正常运行时间

    我尝试计算probe success的数量 并将其乘以探测间隔 试图获得以秒为单位的正常运行时间 并将值类型设置为总数 问题是随着时间范围的变化 最小步骤发生变化 无法给我们正确的读数并使该选项无效 我们实际上想做的是根据仪表板设置的时间范

随机推荐

  • 超详细的python搭建区块链(下)

    在前面 超详细的python搭建区块链 xff08 中 xff09 我们搭建了一个简单的区块链 在这个简单的区块链能够实现交易 挖矿等基本功能 不过 xff0c 区块链上的节点应该是分散的 如果它们是分散的 xff0c 我们究竟如何确保它们
  • RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]

    文章目录 1 问题引入2 运行报错3 代码4 分析原因5 解决办法6 完整代码7 参考文献 1 问题引入 今天在使用pytorch训练一个模型的 xff0c 数据集的读取是使用pytorch自带的函数来进行读取和预处理的 xff0c 网络使
  • 如何在Linux服务器上安装Anaconda(超详细)

    目录 1 安装Anaconda1 1 下载anaconda的安装包1 2 解决安装出现的bug1 3 安装anaconda1 4 点击Enter xff08 回车键 xff09 1 5 输入 yes1 6 继续点击 Enter1 7 输入
  • Pytorch实现FGSM(Fast Gradient Sign Attack)

    目录 1 相关说明2 相关简述3 代码实现3 1 引入相关包3 2 输入3 3 定义被攻击的模型3 4 定义FGSM攻击函数3 5 测试函数 4 可视化结果5 可视化对抗样本6 预训练模型下载7 训练模型8 完整代码 1 相关说明 最近在整
  • RuntimeError: element 0 of tensors does not require grad and does not have a grad_

    文章目录 1 问题描述2 解决方案2 1 方案12 2 方案2 3 参考文献 1 问题描述 今天在跑代码的过程中 xff0c 因为要训练一个模型然后在测试阶段使用PGD来生成相应的adv image来测试这个模型 xff0c 结果运行到测试
  • Pycharm 搭建 Django 项目 (非常详细)

    目录 1 安装需求2 准备工作2 1 新建项目2 2 输入相关配置2 3 项目创建完成2 4 查看安装 Django 版本2 5 启动项目2 6 解决一点小问题 3 一点小补充4 参考文献 1 安装需求 在使用 python 框架 Djan
  • Docker

    官方网站 xff1a https www docker com Docker 是一个开源的应用容器引擎 xff0c 让开发者可以打包他们的应用以及依赖包到一个可移植的容器中 xff0c 然后发布到任何流行的 Linux 机器上 xff0c
  • SpringBoot + Thymeleaf 实现发送验证码计时器功能

    x1f4e2 本文章通过实战记录相关问题以及提供解决方案 x1f464 公众号 xff1a 恩故事还在继续 目录 1 功能需求2 效果图展示3 代码4 参考文献5 联系我 1 功能需求 实现找回密码然后点击获取验证码之后出现XX秒候重新获取
  • 解决 SpringBoot 图片加载失败

    x1f4e2 本文章通过实战记录相关问题以及提供解决方案 x1f464 公众号 xff1a 恩故事还在继续 目录 1 问题描述2 解决方案2 1 打开 IDEA 3 参考文献 1 问题描述 在使用 SpringBoot 开发项目的时候发现了
  • 仿牛客论坛项目部署总结

    x1f4e2 本文章通过实战记录相关问题以及提供解决方案 x1f464 公众号 xff1a 恩故事还在继续 目录 1 前言2 部署项目需求3 环境配置3 1 阿里云服务器3 2 本地文件上传到服务器3 3 MySQL配置与安装3 4 Mav
  • 时间片轮转调度算法的计算

    在分时系统中 xff0c 最简单最常用的就是基于时间片轮转调度算法 xff0c 时间片轮转调度算法是非常公平的处理机分配方式 xff0c 让就绪队列的每个进程每次仅运行一个时间片 1 时间片轮转调度算法的基本原理 在时间片轮转调度算法中 x
  • IntelliJ IDEA添加注释常用的快捷键

    IDEA可以使用快捷键添加行注释Ctrl 43 块注释Ctrl 43 Shift 43 xff0c 还可以快速生成类注释 方法注释等 下面就介绍这几种快捷键的用法 1 行注释Ctrl 43 首先你的光标要处于这一行 xff0c 处于这行的哪
  • Android Studio 设置代码提示和代码自动补全快捷键

    想必使用过Eclipse的小伙伴们都习惯Eclipse快捷键带来的方便 但是当我们使用Android studio来进行开发的时候也想要这种方便该怎么办呢 当然使用过Android studio的小伙伴可能已经知道了它的方便以及强大之处 接
  • 编写一个算法,实现一维数组a输入任意n个整数,假设n=7,输入7个数字为3,7,6,8,9,4,1

    问题描述 编写一个算法 xff0c 实现一维数组a输入任意n个整数 xff0c 假设n 61 7 xff0c 输入7个数字为3 7 6 8 9 4 1 xff0c 然后建立一个具有如图所示的方阵 xff0c 并输出打印 1 3 7 6 8
  • 1.0 DS1302-外部RTC

    一 综述 DS1302是美国DALLAS公司推出的具有涓细电流充电能力的低功耗实时时钟芯片 xff0c 因为应用非常广泛 xff0c 结果就导致了大量的国产仿制品 xff0c GC1302是一款国产DS1302仿制芯片 xff0c 使用方法
  • 现代C++语言

    include lt iostream gt include lt limits gt include lt future gt include lt string gt include lt map gt using namespace
  • ubuntu 解压 打包 命令全集

    tar 解包 xff1a tar xvf FileName tar 打包 xff1a tar cvf FileName tar DirName xff08 注 xff1a tar是打包 xff0c 不是压缩 xff01 xff09 gz 解
  • 在IDEA中解决进行有关详细信息, 请使用 -Xlint:unchecked 重新编译。

    springboot默认的打包是如下 xff1a lt build gt lt plugins gt lt plugin gt lt groupId gt org springframework boot lt groupId gt lt
  • Jetson Nano更换软件源

    Nano的镜像默认是国外的源 xff0c 速度很慢 xff0c 国内的源有的上不去 xff0c 有的包无法安装 xff0c 经过测试清华大学的源完美可用 xff0c 现放上教程 首先备份原本的source list文件 sudo cp et
  • prometheus在k8s中的部署

    1 k8s的监控指标 监控指标具体实现举例Pod性能cAdvisor容器CPU xff0c 内存利用率Node性能node exporter节点CPU xff0c 内存利用率K8S资源对象kube state metricsPod Depl