Open jszwedko opened 2 years ago
Ah - so we walk the customConfig
but with this config there are no components that actually listen on a port. So when we go to render the the service resource/s we have no ports to render, and ports
is required (as the error states).
I'll think about it a bit and try and sneak this into the 0.10.2
release, maybe just checking to see if we have any ports and letting that determine if we create the service 🤔
I think that makes sense. For context, I was trying to deploy Vector to just consume from AWS S3 so it had no need for any listeners. I think other "pull based deployments" of Vector (like consuming from Kafka) would be similar.
I think that makes sense. For context, I was trying to deploy Vector to just consume from AWS S3 so it had no need for any listeners. I think other "pull based deployments" of Vector (like consuming from Kafka) would be similar.
Yep! Definitely reasonable, looking at it though... they way I've set things up it's not super easy to toggle it based on the "contents" of the parsed ports. I don't think this will make it into 0.10.2
. As a workaround service.enabled=false
sidesteps the issue.
Same error when install vector helm chart with customConfig:
helm repo add vector https://helm.vector.dev
helm repo update
kubectl create namespace vector || true
helm install --wait vector vector/vector -n vector --set "customConfig.sinks.sink_to_loki.endpoint=http://loki-loki-distributed-gateway.loki"
namespace/vector created
Error: INSTALLATION FAILED: Service "vector" is invalid: spec.ports: Required value
Same error when install vector helm chart with customConfig:
helm repo add vector https://helm.vector.dev helm repo update kubectl create namespace vector || true helm install --wait vector vector/vector -n vector --set "customConfig.sinks.sink_to_loki.endpoint=http://loki-loki-distributed-gateway.loki" namespace/vector created Error: INSTALLATION FAILED: Service "vector" is invalid: spec.ports: Required value
One immediate thing here is that --set
isn't going to create a valid Vector configuration file, as the entire file would just be
sinks:
sink_to_loki:
endpoint: "http://loki-loki-distributed-gateway.loki"
The cause of this is how the Service
resources are generated, by default we'll parse the customConfig
and look for anything that appears to need a port to listen on and add that to the resource. Both the original configuration and your sample created configurations with no ports to listen on.
The logic doesn't handle not rendering the Service if there were no ports parsed from the config, and Kubernetes doesn't allow for a Service without ports defined.
I recently looked at this but couldn't pull together anything that would work in an automatic fashion, perhaps we should just document this, or try and add a fail
function if there are no ports with a helpful message.
The vector.ports
variable used by the Helm Chart is generated in _helpers.tpl.
It uses generatePort
helper to generate the port. Where is this helper defined ? I cannot find it in the code.
My config is
customConfig:
sources:
kubernetes:
type: kubernetes_logs
sinks:
elasticsearch:
type: elasticsearch
endpoints:
- https://elasticsearch-master:9200
auth:
strategy: basic
user: elastic
password: elastic-password
inputs:
- kubernetes
But vector.ports
stays empty.
What would be a "valid" customConfig that would trigger the ports to be generated ?
generatePorts
is defined in the same file here. A config that will automatically generate valid ports is one that requires requests into Vector.
Your example config has no such components, kubernetes_logs
is local and elasticsearch
is egress only - so there are no ports to define. The services should be disabled in this case.
Thanks! I was tweaking service.ports
and did not even notice there was a service.enabled
key !
I also see this issue when just doing an Agent
deployment on version 0.21.1
I believe I solved this while working on a different project, I'll see if I can port those changes over to resolve this issue 👍
Hi, I have the same error when using Vector with Role Agent, My Loki is set up in the parent cluster, and I want to set up vector agents on child clusters.
Error: 1 error occurred:
* Service "vector" is invalid: spec.ports: Required value
customConfig:
sinks:
loki:
type: loki
inputs: [kubernetes_logs]
compression: snappy
endpoint: https://loki.mydomain.com"
# labels:
# '"pod_labels_*"': "{{ kubernetes.pod_labels }}"
# source: vector
# "{{ event_field }}": "{{ some_other_event_field }}"
out_of_order_action: drop
path: /loki/api/v1/push
remove_timestamp: true
@spencergilbert Can you please share your solution?
@seaadevil Did you set service.enable
to true
?
I disabled the service, and I don't have the error
Hey, i'm using this chart and get also this error. Any update on that ? :)
We haven't had a chance to fix this. If you run into the spec.ports: Required value
error message, you should set service.enabled=false
to avoid creating the kubernetes service altogether.
If anyone is interested in updating this, the fix would be similar to what is done here
I attempted to deploy the chart with the following values file:
To which it gave me: