k8s 进入pod 调用接口
执行wget "URL" 根据响应码判断是否调用成功。进入相应服务的shell页面。响应码为200,为成功。#用于测试服务接口#
#用于测试服务接口#
使用
kubectl exec student-service-74ffcd59d-grlht -it sh
进入相应服务的shell页面
sh-4.2#
执行wget "URL" 根据响应码判断是否调用成功
例如:
sh-4.2# wget "http://setudent-service/common/code/id?user=1"
--2023-12-25 17:53:00-- http://setudent-service/common/code/id?user=1
Resolving setudent-service (setudent-service)... 166.18.55.122
Connecting to setudent-service (setudent-service)|166.18.55.122|:80... connected.
HTTP request sent, awaiting response... 200
Length: unspecified [application/json]
Saving to: 'id?user=1"'
[ <=> ] 21,391 --.-K/s in 0s
2023-12-25 17:53:00 (237 MB/s) - 'id?user=1"3.1' saved [21391]
响应码为200,为成功
如果需要查看返回数据,在shell 用这个命令,请求类型根据接口情况判断
curl -X POST/GET “URL” 用这个命令
更多推荐
所有评论(0)