Kube-probe is a diagnostic tool used within Kubernetes to monitor the health and readiness of applications running in a cluster. It helps ensure that applications are functioning correctly and can handle requests. Kube-probe can be configured to perform liveness, readiness, and startup checks on containers, which are crucial for maintaining the stability and reliability of applications.
When using Kube-probe, you might encounter an error message stating: Probe failed: invalid content type. This error indicates that the probe received a response from the application with a content type that does not match the expected format. This can lead to the probe failing to verify the application's health or readiness.
The error invalid content type typically occurs when the application returns a response with a content type that the probe is not configured to handle. For instance, if the probe expects a JSON response but receives plain text or HTML, it will trigger this error. This mismatch can prevent the probe from parsing the response correctly, leading to a failure in the health check.
To resolve the invalid content type error, follow these steps:
Check the application's response headers to ensure they include the correct content type. You can use tools like cURL to inspect the headers:
curl -I http://your-application-url
Look for the Content-Type
header and ensure it matches the expected type (e.g., application/json
).
Ensure that the probe configuration in your Kubernetes manifest matches the expected content type. For example, if the application returns JSON, your probe might look like this:
livenessProbe:
httpGet:
path: /health
port: 8080
httpHeaders:
- name: Accept
value: application/json
If the application is returning an incorrect content type due to logic errors, update the application code to ensure the correct content type is set in the response headers. For example, in a Node.js application, you can set the content type using:
res.setHeader('Content-Type', 'application/json');
For more information on configuring probes in Kubernetes, refer to the official Kubernetes documentation. Additionally, consider exploring container probes for a deeper understanding of how probes work.
(Perfect for DevOps & SREs)
(Perfect for DevOps & SREs)