为Kubernetes Helm图表上的SonarQube配置SMTP

为Kubernetes Helm图表上的SonarQube配置SMTP,kubernetes,sonarqube,properties-file,Kubernetes,Sonarqube,Properties File,我想在Kubernetes上自动部署SonarQube,所以目标是自动配置所有内容。我成功地为helm chart创建了一个values.yaml,用于安装LDAP插件并使用我们的DC进行配置。但是,当它们出现时,它们似乎被忽视了 已尝试完全删除图表并重新安装: helm delete --purge sonarqube-test helm install stable/sonarqube --namespace sonarqube-test --name sonarqube-test -f v

我想在Kubernetes上自动部署SonarQube,所以目标是自动配置所有内容。我成功地为helm chart创建了一个
values.yaml
,用于安装LDAP插件并使用我们的DC进行配置。但是,当它们出现时,它们似乎被忽视了

已尝试完全删除图表并重新安装:

helm delete --purge sonarqube-test
helm install stable/sonarqube --namespace sonarqube-test --name sonarqube-test -f values-test.yaml
虽然我将例如
http.proxyHost
设置为我们的邮件服务器,但在部署那些
值.yaml
之后,它在UI中仍然是空的

sonarProperties
属性是,而且似乎有效:应用了其他属性,比如来自ldap的属性,因为我可以在更新值后使用ldap登录

我不确定这是否与k8s有关,因为。我使用
kubectl exec
进入容器,查看生成的
sonar.properties
文件,看起来很好:

$ cat /opt/sonarqube/conf/sonar.properties 
email.from=noreply@mydomain.com
email.fromName=SonarQube Test
email.prefix=[SONARQUBE Test]
email.smtp_host.secured=mymailserver.internal
sonar.security.realm=LDAP
sonar.updatecenter.activate=true
sonar.web.javaOpts=-Xmx2048m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -serversonarqube
LDAP还有一些属性,如Bind user等,我删除了这些属性

那么,为什么在更新图表后,甚至在完全删除并重新部署图表时,电子邮件设置都没有应用?

values.yaml

您已经为sonarqube定义了图表,并在value.yaml文件中进行了配置。请注意,您没有根据sonarquebue的定义指定机密名称,您的tls部分应该是这样的。请记住,您必须在适当的命名空间中手动创建此秘密

用于配置tls的模板如下所示:

tls: []
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

So in your case this section should loks like this:

tls: []
# Secrets must be manually created in the namespace.
- secretName: your-secret-name
hosts:
- sonarqube-test.mycluster.internal
同时,在配置postgresql依赖项时,您没有指定用户、数据库、密码和端口,您应该这样做,因为您选择使用此数据库而不是

以下是模板:

database:
type: "postgresql"
## Configuration values for postgresql dependency
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
postgresql:
# Enable to deploy the PostgreSQL chart
enabled: true
# To use an external PostgreSQL instance, set enabled to false and uncomment
# the line below:
# postgresServer: ""
# To use an external secret for the password for an external PostgreSQL
# instance, set enabled to false and provide the name of the secret on the
# line below:
# postgresPasswordSecret: ""
postgresUser: "sonarUser"
postgresPassword: "sonarPass"
postgresDatabase: "sonarDB"
# Specify the TCP port that PostgreSQL should use
service:
port: 5432
SMTP失败的最常见原因是出站邮件配置错误。 您必须在SMTP配置中引入以下参数:

  • SMTP主机
  • SMTP端口
  • SMTP用户名
  • SMTP密码
  • SMTP加密
检查这些参数是否是您的邮件提供商提供的参数。 检查您是否遵循了应用程序文档页面中的“配置出站邮件设置”部分

在您的情况下,您没有指定密码、用户名和端口。 在sonar.properties定义中添加以下部分:

email.smtp_port.secured=port-name
email.smtp_secure_connection.secured=true
email.smtp_username.secured=your-username
email.smtp_password.secured=your-password
下一件事: 确保您的云环境允许SMTP端口中的通信

为了避免大规模垃圾邮件攻击,一些云不允许在其默认端口中使用SMTP通信

  • 谷歌云平台不允许通过默认SMTP通信 端口25、465或587
  • GoDaddy还阻止SMTP通信
以下是有关SMTP问题的疑难解答文档:。 确保你没有一个


如果有帮助,请告诉我。

您已经为sonarqube定义了图表,并在value.yaml文件中进行了配置。请注意,您没有根据sonarquebue的定义指定机密名称,您的tls部分应该是这样的。请记住,您必须在适当的命名空间中手动创建此秘密

用于配置tls的模板如下所示:

tls: []
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

So in your case this section should loks like this:

tls: []
# Secrets must be manually created in the namespace.
- secretName: your-secret-name
hosts:
- sonarqube-test.mycluster.internal
同时,在配置postgresql依赖项时,您没有指定用户、数据库、密码和端口,您应该这样做,因为您选择使用此数据库而不是

以下是模板:

database:
type: "postgresql"
## Configuration values for postgresql dependency
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
postgresql:
# Enable to deploy the PostgreSQL chart
enabled: true
# To use an external PostgreSQL instance, set enabled to false and uncomment
# the line below:
# postgresServer: ""
# To use an external secret for the password for an external PostgreSQL
# instance, set enabled to false and provide the name of the secret on the
# line below:
# postgresPasswordSecret: ""
postgresUser: "sonarUser"
postgresPassword: "sonarPass"
postgresDatabase: "sonarDB"
# Specify the TCP port that PostgreSQL should use
service:
port: 5432
SMTP失败的最常见原因是出站邮件配置错误。 您必须在SMTP配置中引入以下参数:

  • SMTP主机
  • SMTP端口
  • SMTP用户名
  • SMTP密码
  • SMTP加密
检查这些参数是否是您的邮件提供商提供的参数。 检查您是否遵循了应用程序文档页面中的“配置出站邮件设置”部分

在您的情况下,您没有指定密码、用户名和端口。 在sonar.properties定义中添加以下部分:

email.smtp_port.secured=port-name
email.smtp_secure_connection.secured=true
email.smtp_username.secured=your-username
email.smtp_password.secured=your-password
下一件事: 确保您的云环境允许SMTP端口中的通信

为了避免大规模垃圾邮件攻击,一些云不允许在其默认端口中使用SMTP通信

  • 谷歌云平台不允许通过默认SMTP通信 端口25、465或587
  • GoDaddy还阻止SMTP通信
以下是有关SMTP问题的疑难解答文档:。 确保你没有一个


如果有帮助,请告诉我。

这仍然是个问题吗?你修好了吗?@MaggieO遗憾的是,我还没有一个解决方案来自动化这个问题。我目前的解决办法是手动设置并记录这些更改。这仍然是一个问题吗?你修好了吗?@MaggieO遗憾的是,我还没有一个解决方案来自动化这个问题。我目前的解决方法是手动设置并记录这些更改。