在设置 Ingress 以及与 Helm 3 中的部署和服务资源映射期间使用 https 的 Web 应用程序的配置应该是什么。
我应该在 Service.ports 下定义 https 端口和名称还是只更改 Service.Port 名称和端口?或者使用 TLS 已经涵盖了这一点?
ports:
port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
name:https
port:443
Run Code Online (Sandbox Code Playgroud)
服务.yaml
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: 80
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "road-dashboard.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Run Code Online (Sandbox Code Playgroud)
Ingress.yaml
ingress:
enabled: false
annotations:
kubernetes.io/ingress.class: traefik
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
tls: []
# …Run Code Online (Sandbox Code Playgroud) 使用 Jenkins声明式 管道检查前一阶段是否失败的最佳方法是什么,如果失败则运行回滚命令。
我只是尝试如下,但它抛出如下错误。
不允许脚本使用 org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper getRawBuild 方法。管理员可以决定是否批准或拒绝此签名。
stage('Deploy to production'){
when{
beforeAgent true
expression{return env.GIT_BRANCH == "origin/master"}
}
steps{
script{
echo "Deploying production environment"
sh "helm install ...."
}else {
error "Buid was not confirmed"
}
stage('Roll Back'){
when{
expression {
!hudson.model.Result.SUCCESS.equals(currentBuild.rawBuild.getPreviousBuild()?.getResult()) == true
}
}
steps{
script{
sh "helm rollback <release> 0"
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 这可能是一个简单的问题,但我找不到正确的解决方案。
我有一个如下所示的 Docker 映像。我想做的事情只是在 kubernetes pod 中运行curl 命令,但我收到了如下错误。我也无法通过 bash 执行。
$ kubectl exec -ti hub-cronjob-dev-597cc575f-6lfdc -n hub-dev sh
Defaulting container name to hub-cronjob.
Use 'kubectl describe pod/hub-cronjob-dev-597cc575f-6lfdc -n hub-dev' to see all of the containers in this pod.
/usr/src/app $ curl
sh: curl: not found
Run Code Online (Sandbox Code Playgroud)
尝试用 bash
$ kubectl exec -ti cronjob-dev-597cc575f-6lfdc -n hub-dev bash
mand in container: failed to exec in container: failed to start exec "8019bd0d92aef2b09923de78753eeb0c8b60a78619543e4cd27069128a30da92": OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: …Run Code Online (Sandbox Code Playgroud) 我们有两个不同的团队在处理不同的应用程序。我想通过使用相同的警报表达式将警报通知发送到不同的 slack 通道。我找到了一些示例,但不明白receiver: 'default'尝试添加新路由时使用的主要原因是什么?this 的作用是什么,如果它会影响 if 呢?改变这个?
同时,如果您能帮助我如何将通知发送到多个 slack 频道,我将不胜感激。我尝试过新的。
当前的alertmanager.yml
receivers:
- name: 'team-1'
slack_configs:
- api_url: 'https://hooks.slack.com/services/1'
channel: '#hub-alerts'
route:
group_wait: 10s
group_interval: 5m
receiver: 'team-1'
repeat_interval: 1h
group_by: [datacenter]
Run Code Online (Sandbox Code Playgroud)
新的alertmanager.yml
alertmanager.yml:
receivers:
- name: 'team-1'
slack_configs:
- api_url: 'https://hooks.slack.com/services/1'
channel: '#channel-1'
send_resolved: true
- name: 'team-2'
slack_configs:
- api_url: 'https://hooks.slack.com/services/2'
channel: '#channel-2'
send_resolved: true
route:
group_wait: 10s
group_interval: 5m
repeat_interval: 1h
group_by: [datacenter]
receiver: 'default'
routes:
- receiver: 'team-1'
- receiver: 'team-2'
Run Code Online (Sandbox Code Playgroud)
我想将多个 kubeconfig 文件合并到一个配置文件中。我使用 Windows 10 和 PS 作为命令行。我的目录中有 3 个配置文件$HOME\.kube\config,我设置了一个KUBECONFIG环境变量C:\Users\Username\.kube.\config
我尝试了以下命令,但收到一条错误消息:
KUBECONFIG=$HOME.kube\config:$HOME.kube\c1.kubeconfig\$HOME.kube\c2.kubeconfig :无法加载模块“KUBECONFIG=$HOME”。有关更多信息,请运行“Import-Module KUBECONFIG=$HOME”。在行:1个字符:1 + KUBECONFIG=$HOME.kube\config:$HOME.kube\c1.kubeconfig\$HOME.k ... + ~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ + CategoryInfo : ObjectNotFound: (KUBECONFIG=$HOM...2.kubeconfig:String) [], CommandNotFoundException + ExcellentQualifiedErrorId : CouldNotAutoLoadModule
KUBECONFIG=$HOME\.kube\config:$HOME\.kube\c1.kubeconfig\$HOME\.kube\c2.kubeconfig kubectl config view --merge --flatten $HOME\.kube\merged_kubeconfig
Run Code Online (Sandbox Code Playgroud)
我的文件夹结构如下。
.kube
-c1.kubeconfig
-c2.kubeconfig
-config
Run Code Online (Sandbox Code Playgroud) 我有一些微服务,其中之一需要使用 postreSQL。我使用 Helm 3 配置此微服务。每个环境都有两个不同的 values.yaml,例如 values.stage.yaml 和 values.prod.yaml。所以我的困惑是,
2.以后如果有更多的微服务要使用同一个PostreSQL,我该怎么做才能提供这个功能。
kubernetes ×3
docker ×1
dockerfile ×1
jenkins ×1
jenkins-declarative-pipeline ×1
monitoring ×1
postgresql ×1
prometheus ×1