小编Jho*_*n D的帖子

为存在的资源安装 Helm 3

运行时helm install(helm 3.0.2)

我收到以下错误:错误: rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: kind: PodSecurityPolicy, namespace: , name: po-kube-state-metrics

但是我没有找到它,并且在错误中我没有得到 ns,我该如何删除它?

运行时,kubectl get all --all-namespaces我看到所有资源,但看不到po-kub-state-metrics... 它也发生在其他资源上,知道吗?

我得到了同样的错误:monitoring-grafanaentity,结果 kubectl get PodSecurityPolicy --all-namespaces是:

monitoring-grafana false RunAsAny RunAsAny RunAsAny RunAsAny false configMap,emptyDir,projected,secret,do

kubernetes kubernetes-helm

25
推荐指数
3
解决办法
3万
查看次数

将Prometheus运算符与DB卷一起用于k8s

我们正在尝试使用Grafana和Prometheus Operator监视K8S,
大多数指标都按预期工作,并且我能够看到具有正确值的仪表板,我们的系统包含10个节点,总共500个Pod,现在当我重新启动Prometheus时,所有数据已被删除(我希望将其存储两周)我的问题是,如何定义Prometheus卷以将数据保留两周或100GB DB。我发现以下内容(我们使用Prometheus运算符)

https://github.com/coreos/prometheus-operator/blob/master/Documentation/user-guides/storage.md

这是Prometheus运算符的配置

apiVersion: apps/v1beta2
kind: Deployment
metadata:
  labels:
    k8s-app: prometheus-operator
  name: prometheus-operator
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: prometheus-operator
  template:
    metadata:
      labels:
        k8s-app: prometheus-operator
    spec:
      containers:
      - args:
        - --kubelet-service=kube-system/kubelet
        - --logtostderr=true
        - --config-reloader-image=quay.io/coreos/configmap-reload:v0.0.1
        - --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.29.0
        image: quay.io/coreos/prometheus-operator:v0.29.0
        name: prometheus-operator
        ports:
        - containerPort: 8080
          name: http
Run Code Online (Sandbox Code Playgroud)

这是Prometheus的配置

    apiVersion: monitoring.coreos.com/v1
    kind: Prometheus
    metadata:
      name: prometheus
      namespace: monitoring
      labels: 
        prometheus: prometheus
    spec:
      replica: 2
      serviceAccountName: prometheus
      serviceMonitorNamespaceSelector: {}
      serviceMonitorSelector:
        matchLabels: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services google-cloud-platform kubernetes prometheus prometheus-operator

17
推荐指数
1
解决办法
1499
查看次数

更改容器运行时的日志级别

我使用它logrus来记录在 K8S 上运行的应用程序\n我们有 env 变量,我们可以设置log-level它并在重新启动应用程序时更改它\n我们的应用程序正在 k8s 上使用 docker 容器运行\n现在我们想要更改日志级别运行时,即不要\xe2\x80\x99t重新启动容器并更改它\n当它\xe2\x80\x99s运行时,我们可以将其从 更改为errordebug我认为这是合法的请求,但没有\xe2\x80\ x99t 找到任何参考或任何这样做的开源代码,有什么想法吗?

\n\n
package logs\n\nimport (\n    "fmt"\n    "os"\n\n    "github.com/sirupsen/logrus"\n)\n\nconst (\n    AppLogLevel = \xe2\x80\x9cAPP_LOG_LEVEL"\n    DefLvl = "info"\n)\n\n\nvar Logger *logrus.Logger\n\n\nfunc NewLogger() *logrus.Logger {\n\n    var level logrus.Level\n    lvl := getLogLevel()\n    // In case level doesn\'t set will not print any message\n    level = logLevel(lvl)\n    logger := &logrus.Logger{\n        Out:   os.Stdout,\n        Level: level,\n    }\n    Logger = logger\n    return Logger\n}\n\n// use from env\nfunc getLogLevel() string {\n    lvl, _ …
Run Code Online (Sandbox Code Playgroud)

logging go docker kubernetes

5
推荐指数
1
解决办法
2万
查看次数

Envoy 访问日志持续时间字段

我们正在使用访问日志字段来提供持续时间类型我们正在使用以下内容

totalDuration: '%DURATION%'
upstreamTime: '%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%'
Run Code Online (Sandbox Code Playgroud)

我们正在获取这些值,但是它在访问日志中的值相同(完全相同的时间),为什么?我想持续时间应该总是大于 upstram_service_time 我在这里错过了什么?

1 We need the total time of the calls E2E - for that we use '%DURATION%'
2. How much time it spent e2e on the upstream '%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%'
Run Code Online (Sandbox Code Playgroud)

可以打印微秒吗?也许我们可以看到差异

kubernetes envoyproxy

5
推荐指数
0
解决办法
423
查看次数

kubebuilder 在本地调试 web-hooks

我们有一个 kubebuilder 控制器,它按预期工作,现在我们需要创建一个 webhooks ,

我按照教程 https://book.kubebuilder.io/reference/markers/webhook.html进行 操作,现在我想在本地运行和调试它,但是不确定如何处理证书,是否有一种简单的方法来创建它,任何例子都会非常有帮助。

顺便说一句,我已经安装了cert-manager并应用了以下示例 yaml,但不知道下一步该做什么...

我需要最简单的解决方案,我能够在本地webhook运行和调试s ,就像我已经使用控制器所做的那样(在使用 webhooks 之前),

https://book.kubebuilder.io/cronjob-tutorial/running.html

证书管理器

我在集群中创建了以下内容

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: example-com
  namespace: test
spec:
  # Secret names are always required.
  secretName: example-com-tls

  # secretTemplate is optional. If set, these annotations and labels will be
  # copied to the Secret named example-com-tls. These labels and annotations will
  # be re-reconciled if the Certificate's secretTemplate changes. secretTemplate
  # is also enforced, …
Run Code Online (Sandbox Code Playgroud)

certificate go google-cloud-platform kubernetes kubebuilder

5
推荐指数
1
解决办法
710
查看次数

安装 npm 后找不到 Docker 映像错误 bin

我需要扩展一个 Dockerfile 并添加grunt到它。我做了以下事情:

这个 docker 按原样运行

    FROM openjdk:8-jdk-slim
    ARG ND=v12.13.0

    RUN apt-get update && \
        apt-get install --yes --no-install-recommends curl  && \

        NODE_H=/opt/nodejs; mkdir -p ${NODE_H} && \
        curl --fail --silent --output - "http://nodejs.org/dist/${ND}/node-${ND}-linux-x64.tar.gz" \
         | tar -xzv -f - -C "${NODE_H}" && \
        ln -s "${NODE_H}/node-${ND}-linux-x64/bin/npm" /usr/local/bin/npm && \
        ln -s "${NODE_H}/node-${ND}-linux-x64/bin/node" /usr/local/bin/node && \
        ln -s "${NODE_H}/node-${ND}-linux-x64/bin/npx" /usr/local/bin/ && \



    npm install grunt-cli -g

    RUN grunt -v
Run Code Online (Sandbox Code Playgroud)

我还提出了以下没有帮助的内容...

ENV PATH="$PATH:/usr/local/bin"
Run Code Online (Sandbox Code Playgroud)

当我运行命令时grunt-v,出现以下错误:

/bin/sh: …

path node.js gruntjs docker dockerfile

3
推荐指数
1
解决办法
815
查看次数