sealed-secrets: Bug in regards to "cannot fetch certificate: no endpoints available for service "http:sealed-secrets-controller:"
This is after reading #317 #397 and #368 all slightly related.
Description
Error message:
cannot fetch certificate: no endpoints available for service "http:sealed-secrets-controller:
Repro Steps
if my sealed-secrets-controller
service
is configured with:
spec:
clusterIP: 172.20.54.13
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
it does NOT work
but if you remove the port name http
it works fine, i.e.
spec:
clusterIP: 172.20.54.13
ports:
- port: 8080
protocol: TCP
targetPort: 8080
Testing
shell 1
kubectl proxy
shell2
curl http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/http:sealed-secrets-controller:/proxy/v1/cert.pem
Other Related Information
I use the bitnami kube.libsonnet libraries to manage my deployments & services, only using upstream yamls as reference (not truth), and Service()
function does this automatically!
Service(name): $._Object("v1", "Service", name) {
local service = self,
target_pod:: error "service target_pod required",
port:: self.target_pod.spec.containers[0].ports[0].containerPort,
// Helpers that format host:port in various ways
host:: "%s.%s.svc" % [self.metadata.name, self.metadata.namespace],
host_colon_port:: "%s:%s" % [self.host, self.spec.ports[0].port],
http_url:: "http://%s/" % self.host_colon_port,
proxy_urlpath:: "/api/v1/proxy/namespaces/%s/services/%s/" % [
self.metadata.namespace,
self.metadata.name,
],
// Useful in Ingress rules
name_port:: {
serviceName: service.metadata.name,
servicePort: service.spec.ports[0].port,
},
spec: {
selector: service.target_pod.metadata.labels,
ports: [
{
port: service.port,
name: service.target_pod.spec.containers[0].ports[0].name,
targetPort: service.target_pod.spec.containers[0].ports[0].containerPort,
},
],
type: "ClusterIP",
},
},
https://github.com/bitnami-labs/kube-libsonnet/blob/master/kube.libsonnet#L181
The curl call can be resolved by appending the port name:
curl http://127.0.0.1:8001/api/v1/namespaces/kube-system/services/http:sealed-secrets-controller:http/proxy/v1/cert.pem
- http:sealed-secrets-controller:
+ http:sealed-secrets-controller:http
kube.libsonnet
workaround
local k = import 'kubernetes/kube.libsonnet';
{
local addon = $.sealedSecrets,
local config = $.config_.sealedSecrets,
sealedSecrets+: {
service+: k.Service(config.name, config.namespace) {
local service = self,
target_pod:: addon.deployment.spec.template,
spec+: {
ports: [
// this port must be unnamed until this issue is resolved
// https://github.com/bitnami-labs/sealed-secrets/issues/502
{
port: service.port,
targetPort: service.target_pod.spec.containers[0].ports[0].containerPort,
},
],
},
},
},
}
Note: lib/
is in my jsonnet path (I’m using Tanka), and so kubernetes/kube.libsonnet
actually refers to a local file lib/kubernetes/kube.libsonnet
which wraps the upstream bitnami-labs kube.libsonnet. Just adding this note in case anyone is confused why the function here takes 2 arguments (name & namespace) where the upstream requires only 1 argument.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 24 (3 by maintainers)
Commits related to this issue
- Use Istio port name naming convention See https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection Fixes: https://github.com/bitnami-labs/sea... — committed to sathieu/sealed-secrets by sathieu 3 years ago
- Use Istio port name naming convention See https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection Fixes: https://github.com/bitnami-labs/sea... — committed to sathieu/sealed-secrets by sathieu 3 years ago
- Use Istio port name naming convention See https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#explicit-protocol-selection Fixes: https://github.com/bitnami-labs/sea... — committed to sathieu/sealed-secrets by sathieu 3 years ago
- downgrade sealed-secrets to v2.0.0 — committed to pyldin601/servers by pyldin601 3 years ago
- Fix several bugs in servicemonitor (#690) — committed to bitnami-labs/sealed-secrets by alvneiayu 3 years ago
- Fix Cannot fetch certificate: no endpoints available for service "http:sealed-secrets-controller:" See also https://istio.io/latest/docs/ops/configuration/traffic-management/protocol-selection/#expli... — committed to sathieu/sealed-secrets by sathieu 3 years ago
- Update kubeseal to 0.17.2 https://github.com/bitnami-labs/sealed-secrets/issues/502 Signed-off-by: zoetrope <a.ikezoe@gmail.com> — committed to cybozu-go/accurate by zoetrope 2 years ago
- Update kubeseal to 0.17.2 https://github.com/bitnami-labs/sealed-secrets/issues/502 Signed-off-by: zoetrope <a.ikezoe@gmail.com> — committed to cybozu-go/accurate by zoetrope 2 years ago
Hi everyone!
Thanks so much for reporting this! The changes we recently introduced at https://github.com/bitnami-labs/sealed-secrets/pull/690 (introducing a name for the http port exposed in the service) broke the compatibility with kubeseal.
This should be fixed by this PR: https://github.com/bitnami-labs/sealed-secrets/pull/648
In the meantime, you can workaround this by removing the
name
and settingtargetPort: 8080
as @glitchcrab pointed out at https://github.com/bitnami-labs/sealed-secrets/issues/694#issuecomment-997370679.@Mirdrack This works for me, with chart 2.1.0 and app v0.17.2:
This is expected.
Have you updated kubeseal?
I just installed kubeseal following the fluxcd documentation.
This used the 2.6.0 version of the chart and 0.18.1 of the application.
I also just installed version 0.18.1 of the kubeseal CLI.
I’m still getting the timeout error.
I can port forward the service and retrieve the certificate.
That should be automatically done in a few hours @davidkarlsen
There’s a bot (https://github.com/BrewTestBot) that usually does the magic for us updating this homebrew formula: https://github.com/Homebrew/homebrew-core/blob/master/Formula/kubeseal.rb
Sorry, forgot to mention. AWS EKS 1.21.5.
In my case same Helm chart: bitnami-labs works fine on Rancher RKE on prem clusters and not on cloud.
Same Helm, with same values (deployed as HelmRelease via Flux)
In the the
sealed-secrets-controller
svc
there is no port name by default. Tried to add/remove & change it manually by editing thesvc
which didn’t help.In the
Helm values
(of the working on prem clusters) I set the values:but with and without this
value
it fails in cloud (civo + Digital Ocean) with error:when running
kubeseal
command:Again, exact same Helm works On prem
Helm values:
Service