It seems that Azure Container Instances does not have a tcpSocket in its livenessProbe selection.
How should a replacement for it be created in Bash? (netcat or nc is not an option with current base container)
e.g. I have application running a TCP server in port 8777 and I can use following Bash command
timeout 1 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/8777'
to check that it is still running, but if I try to execute similar check in YAML
livenessProbe:
exec:
command:
- /bin/bash -c "timeout 1 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/8777'"
if fails with following error:
Liveness probe failed: to exec in container: failed to start exec "fafa…": quest RPC failure: failed to run runc create/exec call for container b12de… with exit status 1: exec failed: container_linux.go:380: starting container process caused: exec: "/bin/bash -c "timeout 1 bash -c ‘cat < /dev/null > /dev/tcp/127.0.0.1/8107’"": stat /bin/bash -c "timeout 1 bash -c ‘cat < /dev/null > /dev/tcp/127.0.0.1/8107’": no such file or directory: unknown
2
Answers
It seems that the command must be splitted to multiple parts. At least the following works
In Azure Container Instances, You can make use of readiness probe as mentioned in this MS Document1 and also Liveness probe as mentioned in this MS Document2
As mentioned in MS Document1 you can create a yaml file with readiness-probe.yaml with the code below:-
And Deploy it in Azure Container Instances by running this command in your CLI:-
Output:- https://i.imgur.com/aYXTrdk.png
To Deploy Liveness probe you can create include the liveness probe in your existing YAML file or create a new one by referring the MS Document2
liveness.yaml:-
Output:- https://i.imgur.com/aOEowsG.png https://i.imgur.com/QNqsQuf.png