小编sha*_*vah的帖子

如何在 GKE 上创建 CloudSQL 代理凭据作为机密

我已按照https://cloud.google.com/sql/docs/mysql/connect-kubernetes-engine 中的步骤设置 MySQL 用户帐户和服务帐户。我已经下载了包含我的凭据的 JSON 文件。

我的问题是在我从网站复制的代码中:

- name: cloudsql-proxy
  image: gcr.io/cloudsql-docker/gce-proxy:1.11
  command: ["/cloud_sql_proxy",
            "-instances=<INSTANCE_CONNECTION_NAME>=tcp:3306",
            "-credential_file=/secrets/cloudsql/credentials.json"]
  securityContext:
    runAsUser: 2  # non-root user
    allowPrivilegeEscalation: false
  volumeMounts:
    - name: cloudsql-instance-credentials
      mountPath: /secrets/cloudsql
      readOnly: true
Run Code Online (Sandbox Code Playgroud)

指定了路径 /secrets/cloudsql/credentials.json ,我不知道它来自哪里。

我想我应该通过以下方式创建凭据作为秘密

kubectl create secret generic cloudsql-instance-credentials --from-file=k8s\secrets\my-credentials.json

但在那之后我不知道该怎么办。这个秘密是如何成为路径的/secrets/cloudsql/credentials.json

google-cloud-sql kubernetes google-kubernetes-engine cloud-sql-proxy

7
推荐指数
1
解决办法
3360
查看次数

如何为 Filebeat 配置 JBoss JsonFormatter (WildFly 14)

我有 Filebeat 从标准输出中提取日志。我想确保我的日志输出为 JSON,以便可以正确解析它们。

到目前为止,这是我发现的:

  • org.jboss.logmanager.formatters 没有 JSON 格式化程序
  • 有一个提供 JsonFormatter 类的“扩展”模块
  • 我可以通过执行以下操作在我的 logging.properties 中使用它:
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush,target
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=JSON-FORMATTER
handler.CONSOLE.target=SYSTEM_OUT

formatter.JSON-FORMATTER=org.jboss.logmanager.ext.formatters.JSONFormatter
Run Code Online (Sandbox Code Playgroud)

我需要知道:

  • 我是否缺少此配置的任何内容?
  • 如何自定义 JSON 输出(即添加或删除字段)?

java logging jboss wildfly filebeat

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