Probably long time took to boot and wrong validation if workload is running and workload is listening: I have seen that if the workload is not listening curl will hang and not work.
Possible fixes:
I see curl failed, if that happend that means that kubectl wait deployment
and kubectl get pods ... | grep Running
where done, but I dont see why if are done the runtime logs still are at start
stage. Probably was valid but because
I dont get at what time curl was launched confuces me .
I think adding curl smaller timeout but more retry could be better
# Create deployment
kubectl create -f "${pod_config_dir}/deployment-expose-ip.yaml"
# Check deployment creation
cmd="kubectl wait --for=condition=Available deployment/${deployment}"
waitForProcess "$wait_time" "$sleep_time" "$cmd"
# Check pods are running
cmd="kubectl get pods -o jsonpath='{.items[*].status.phase}' | grep Running"
waitForProcess "$wait_time" "$sleep_time" "$cmd"
# Expose deployment
kubectl expose deployment/${deployment} --type=LoadBalancer --name=${service}
# There appears to be no easy way to formally wait for a loadbalancer service
# to become 'ready' - there is no service.status.condition field to wait on.
# Now obtain the local IP:port pair of the loadbalancer service and ensure
# we can curl from it, and get the expected result
svcip=$(kubectl get service ${service} -o=json | jq '.spec.clusterIP' | sed 's/"//g')
svcport=$(kubectl get service ${service} -o=json | jq '.spec.ports[].port')
# And check we can curl the expected response from that IP address
echo_msg="hello,world"
curl http://$svcip:$svcport/echo?msg=${echo_msg} | grep "$echo_msg"
May 12 06:09:04 ubuntu1804-azure795540 kata-runtime[101698]: time="2020-05-12T06:09:04.115552384Z" level=info msg="release sandbox" arch=amd64 command=start container=0849f7cb7c630324ypervisor[101391]: time="2020-05-12T06:09:03.535231576Z" level=debug msg="updating cpuset cgroup" container=0849f7cb7c63032411802c94177d994d21a78d44055805faf69fc32e8d3632d1 debug_console=false name=kata-agent pid=41 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
May 12 06:09:04 ubuntu1804-azure795540 kata-hypervisor[101391]: time="2020-05-12T06:09:03.543613357Z" level=debug msg="cpuset cgroup already updated" debug_console=false name=kata-agent path=/sys/fs/cgroup/cpuset/kubepods pid=41 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
May 12 06:09:04 ubuntu1804-azure795540 kata-hypervisor[101391]: time="2020-05-12T06:09:03.551170836Z" level=debug msg="cpuset cgroup already updated" debug_console=false name=kata-agent path=/sys/fs/cgroup/cpuset/kubepods/besteffort pid=41 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
May 12 06:09:04 ubuntu1804-azure795540 kata-hypervisor[101391]: time="2020-05-12T06:09:03.543227815Z" level=debug msg="new request" debug_console=false name=kata-agent pid=41 req="container_id:\"0849f7cb7c63032411802c94177d994d21a78d44055805faf69fc32e8d3632d1\" exec_id:\"0849f7cb7c63032411802c94177d994d21a78d44055805faf69fc32e8d3632d1\" len:32768 " request=/grpc.AgentService/ReadStderr sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
May 12 06:09:04 ubuntu1804-azure795540 kata-hypervisor[101391]: time="2020-05-12T06:09:03.5719809Z" level=debug msg="cpuset cgroup already updated" debug_console=false name=kata-agent path=/sys/fs/cgroup/cpuset/kubepods/besteffort/pod5db5005a-870a-446d-abfd-650f1492285b pid=41 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
May 12 06:09:04 ubuntu1804-azure795540 kata-hypervisor[101391]: time="2020-05-12T06:09:03.581865672Z" level=debug msg="updating cpuset cgroup" debug_console=false name=kata-agent path=/sys/fs/cgroup/cpuset/kubepods/besteffort/pod5db5005a-870a-446d-abfd-650f1492285b/0849f7cb7c63032411802c94177d994d21a78d44055805faf69fc32e8d3632d1/cpuset.cpus pid=41 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=agent
11802c94177d994d21a78d44055805faf69fc32e8d3632d1 name=kata-runtime pid=101698 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=virtcontainers subsystem=sandbox
May 12 06:09:04 ubuntu1804-azure795540 kata-runtime[101698]: time="2020-05-12T06:09:04.115723485Z" level=info msg="Disconnecting Sandbox Console" arch=amd64 command=start container=0849f7cb7c63032411802c94177d994d21a78d44055805faf69fc32e8d3632d1 function=disconnect name=kata-runtime pid=101698 sandbox=b7a29ccea4881a7402cf0c9e867b94bb0a2f8c09ee8299986c10b546fa932754 source=virtcontainers subsystem=cloudHypervisor
not ok 1 Expose IP Address
# (in test file k8s-expose-ip.bats, line 51)
# `curl http://$svcip:$svcport/echo?msg=${echo_msg} | grep "$echo_msg"' failed
# INFO: k8s configured to use runtimeclass
# deployment.apps/hello-world created
# deployment.apps/hello-world condition met
# Running
# service/my-service exposed
# % Total % Received % Xferd Average Speed Time Time Time Current
# Dload Upload Total Spent Left Speed
#
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:06 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:08 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:09 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:10 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:11 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:12 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:13 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:14 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:15 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:16 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:17 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:18 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:19 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:20 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:21 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:22 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:23 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:24 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:25 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:26 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:27 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:28 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:29 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:30 --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- 0:00:31 --:--:-- 0curl: (7) Failed to connect to 10.100.126.181 port 8080: Connection timed out
# service "my-service" deleted
# deployment.apps "hello-world" deleted