-
카테고리
-
세부 분야
데브옵스 · 인프라
-
해결 여부
미해결
master node connetction error
22.11.10 10:59 작성 조회수 1.1k
0
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요!
- 먼저 유사한 질문이 있었는지 검색해보세요.
- 서로 예의를 지키며 존중하는 문화를 만들어가요.
- 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
안녕하세요. 현재 포드디스크립터 부분을 시청 중이며 실습은 GCP 프로젝트에서 진행하고 있습니다.
문제점 1.
go-http-pod.yaml 작성 후 create 시
The connection to the server 10.128.0.6:6443 was refused - did you specify the right host or port?
라는 에러가 발생합니다.
gcp에서 vm 생성 후 마스터노드 및 워커노드 생성(통신 되는 것 확인)
kubectl get pod / kubectl get nodes 명령어 실행 시에도 port refused 문제 발생
방화벽 문제라고 판단하여 rule 추가(6443 포트 allow) 하였으나 해결되지 않음
kubelet stop/restart 시 kubectl get pod 실행 가능하지만 5분 이내 다시 port refused 문제 발생
root@master:~/yaml# kubectl get nodes
The connection to the server 10.128.0.6:6443 was refused - did you specify the right host or port?
root@master:~/yaml# systemctl restart kubelet
root@master:~/yaml# kubectl get nodes
NAME STATUS ROLES AGE VERSION
master Ready control-plane 17h v1.25.3
work-node NotReady <none> 17h v1.25.3
kubelet 때문에 발생하는 문제 같은데 지운 뒤 실습해도 문제가 없나요?
문제점 2.
http-go pod를 생성했으나 ContainerCreating 에서 멈춰있습니다.
root@master:~/yaml# kubectl get pod
NAME READY STATUS RESTARTS AGE
http-go 0/1 ContainerCreating 0 17h
문제점 1 명령어 히스토리 첨부합니다.
64 systemctl stop kubelet
65 systemctl start kubelet
66 kubectl get pod
67 kubectl get node
68 kubectl get nodes
69 strace -eopenat kubectl version
70 kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
71 podsecuritypolicy.policy/psp.flannel.unprivileged created
72 clusterrole.rbac.authorization.k8s.io/flannel created
73 clusterrolebinding.rbac.authorization.k8s.io/flannel created
74 serviceaccount/flannel created
75 configmap/kube-flannel-cfg created
76 daemonset.apps/kube-flannel-ds created
77 kubectl get pod
78 ls -al .kube/
79 cat .kube/config
80 cat .kube/cache/
81 systemctl restart kubelet
82 kubectl get pod
83 export KUBECONFIG=/home/$(whoami)/.kube/config
84 netstat -tulpn | grep -i 6443
85 /usr/local/bin/kube-apiserver \\
86 --advertise-address=${INTERNAL_IP} \\
87 --allow-privileged=true \\
88 --apiserver-count=3 \\
89 --audit-log-maxage=30 \\
90 --audit-log-maxbackup=3 \\
91 --audit-log-maxsize=100 \\
92 --audit-log-path=/var/log/audit.log \\
93 --authorization-mode=Node,RBAC \\
94 --bind-address=0.0.0.0 \\
95 --client-ca-file=/var/lib/kubernetes/ca.crt \\
96 --enable-admission-plugins=NodeRestriction,ServiceAccount \\
97 --enable-swagger-ui=true \\
98 --enable-bootstrap-token-auth=true \\
99 --etcd-cafile=/var/lib/kubernetes/ca.crt \\
100 --etcd-certfile=/var/lib/kubernetes/etcd-server.crt \\
101 --etcd-keyfile=/var/lib/kubernetes/etcd-server.key \\
102 --etcd-servers=https://192.168.5.11:2379,https://192.168.5.12:2379 \\
103 --event-ttl=1h \\
104 --encryption-provider-config=/var/lib/kubernetes/encryption-config.yaml \\
105 --kubelet-certificate-authority=/var/lib/kubernetes/ca.crt \\
106 --kubelet-client-certificate=/var/lib/kubernetes/kube-apiserver.crt \\
107 --kubelet-client-key=/var/lib/kubernetes/kube-apiserver.key \\
108 --kubelet-https=true \\
109 --runtime-config=api/all \\
110 --service-account-key-file=/var/lib/kubernetes/service-account.crt \\
111 --service-cluster-ip-range=10.96.0.0/24 \\
112 --service-node-port-range=30000-32767 \\
113 --tls-cert-file=/var/lib/kubernetes/kube-apiserver.crt \\
114 --tls-private-key-file=/var/lib/kubernetes/kube-apiserver.key \\
115 --v=2
116 kubectl get pod
+ 여러번에 재설치 끝에 다시 작동 되었으나
master-work 노드의 not ready 상태 를 ready 상태로 변경하기 위해서 시도한
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
이 명령어가 문제였던 것 같습니다.
root@master-node:~# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Unable to connect to the server: dial tcp: lookup cloud.weave.works on 169.254.169.254:53: no such host
root@master-node:~# kubectl get nodes
Get "https://10.128.0.4:6443/api/v1/nodes?limit=500": dial tcp 10.128.0.4:6443: connect: connection refused - error from a previous attempt: http2: server sent GOAWAY and closed the connection; LastStreamID=1, ErrCode=NO_ERROR, debug=""
root@master-node:~# kubectl get nodes
The connection to the server 10.128.0.4:6443 was refused - did you specify the right host or port?
root@master-node:~#
명령어 시도 후 이렇게 뜨는데요
다른 방법이 있으시면 알려주셨으면 합니다. ㅜㅜ
답변을 작성해보세요.
0
gasbugs
2022.11.11
안녕하세요
혹시 현재 시스템 환경이 어떻게 되시나요?
우분투22.04부터는 말씀하신 것과 같은 이유를 알 수 없는 유사한 문제가 나타나기도 합니다.
추가로 weavenet 설치와 관계 없이 kubectl get nodes 명령은 동작해야 합니다.
감사합니다.
쏭지
질문자2022.11.17
버전 낮춰서 다시 헀는데 이젠 pod 생성하면 container creating 이 뜨면서 해결이 안됩니다.
weave로 설치하려고 하면
이렇게 떠서 플란넬을 대신 사용했거든요
그런데 계속 이상태입니다.
*http-go 생성하기 전에 테스트용으로 생성
describe pod 시
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m30s default-scheduler Successfully assigned default/nx-7b4ff8dbd5-wwrls to work-2
Warning FailedCreatePodSandBox 2m29s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "8e81f249ef21562a7f009d10ecd2f549d0fc982152b41a6adbd8cf02859daffd": open /run/flannel/subnet.env: no such file or directory
샌드박스 관련 에러 찾아서 트러블슈팅을 해봤는데도 안되서요
클린업 하고 재설치도 몇번 다시 했는데도 안되네요
/run/flannel/subnet.env에도 파일을 만들어주긴 했으나 역시나 해결되지 않았습니다.
다른방법이 있다면 알려주셨으면 합니다.
gasbugs
2022.12.20
죄송합니다. 댓글이 저한테 알림이 오는 시스템이 아니라서 이제 확인했습니다 ㅠㅠ 앞으로는 질문을 새로 올려주시면 바로 답변 드릴 수 있도록 하겠습니다. 아직 해결이 안되셨으면 cilium을 설치해보시기를 추천드립니다. 설치 방식이 많이 변경되어서 곧 영상으로도 업데이트 드리겠습니다. 감사합니다.
답변 1