Service port not found in Application

Services connect Kubernetes applications. Label selectors are used to associate Pods with Services. This validator detects a condition when no application is associated with a Service. It usually indicates a naming error in workload or Service labels.

Affected Resources: Service

Examples

apiVersion: v1 kind: Service metadata: name: my-app-service spec: type: ClusterIP selector: foo: bar ports: - name: web port: 80 protocol: TCP targetPort: 3000 # pointing to port 3000 but app exposes port 4000
apiVersion: apps/v1 kind: Deployment metadata: name: my-app labels: foo: bar spec: containers: - name: worker image: nginx ports: - containerPort: 4000 # exposing port 4000 but Service points to 3000

Resolution

  • Identify which port is exposed in the app and make correction to the Service targetPort.
  • Need other validation rules?

    Please let us know if there are other built-in validation rules you would like to see in Kubevious to detect misconfigurations and violations to best practices. Optionally, you can provide your details so we can reach out to you with follow-up questions.

    Share this article on:
    message