Hello I'am new on K8S and react typescript app, I'am trying to deploy my react application with typescript, i have an error in Kubernetes deployment
Liveness probe failed: HTTP probe failed with statuscode: 404
where should I put the well-known routes /.well-known/live and /.well-known/ready ? and what should I write for it ?
CodePudding user response:
where should I put the well-known routes /.well-known/live and /.well-known/ready ? and what should I write for it ?
No need for it if you are serving index from your container with Nginx/Apache it will work in that case you need to update the K8s YAML config and update HTTP probe
path to just /
probaly so when K8s check it's hit to root(index.html)
main page of your react app.
Ways to mitigate
Liveness probe failed: HTTP probe failed with statuscode: 404
This clearly means Kubernetes failed to verify or check the health of deployment in K8s.
in your error status code is : 404
which means it was not able to get or hit the HTTP endpoint.
i am not sure how your route works and application is configured however this is the simplest HTTP option you could use.
app.get('/live',(req,res)=> {
res.send ("OK");
});
K8s periodically check the HTTP status on this endpoint that you have configured using YAML config file.
Nginx checks
If you are deploying the separate Frontend pod and can not keep HTTP endpoint in container
You can use the default endpoint of Apache/Nginx
as liveness probe just like /
so by default Nginx or Apache return 200
on /
Or else
you can also give any HTML file name from your code, /index-live.html
so when K8s will check /live
endpoint frontend container will serve html file with status code 200.