kubernetes/trouble shooting
[k8s] curl 오류
bbiyak2da
2025. 1. 8. 15:15
curl 오류
동일 Node 내 A Pod에서 B Pod에서 Curl 명령시, 조회가 되지 않았다.
이유는 다양해보이지만 일단 Selinux를 disabled 하니까 해결되긴 되었다,,
해결 방법
apt install selinux-utils
setenforce 0
결과
root@master:~# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
my-nginx-587f57b444-ffpxq 1/1 Running 0 100m 192.168.166.132 node1 <none> <none>
my-nginx-587f57b444-glhq7 1/1 Running 0 100m 192.168.104.4 node2 <none> <none>
testpod 1/1 Running 0 19m 192.168.104.5 node2 <none> <none>
root@master:~# kubectl exec -it testpod /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
root@testpod:/# curl 192.168.104.4
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>