k8s를 사용하다보면 여러가지 사유로 끊기거나 service가 잘 시작 안될때가 있다.
이때는
kubeadm reset
명령어를 통해서 새롭게 시작할 수 있다.
아래 로그를 보면 node가 이미 클러스터에 등록된 것으로 확인 된다. 이 오류를 해결하기 위해서 reset을 통해 초기화 시키고 node를 클러스터에 등록하는 것을 확인 할 수 있다.
ubuntu@node:~$ kubeadm join 192.168.241.92:6443 --token cn1jrh.nmkfl966puecshrz \
> --discovery-token-ca-cert-hash sha256:9bb6bcec1f1649d04908fa2987ec7d918de0a939df247cb5eb5fb25fe6349c05
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR IsPrivilegedUser]: user is not running as root
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
ubuntu@node:~$ sudo kubeadm join 192.168.241.92:6443 --token cn1jrh.nmkfl966puecshrz --discovery-token-ca-cert-hash sha256:9bb6bcec1f1649d04908fa2987ec7d918de0a939df247cb5eb5fb25fe6349c05
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR FileAvailable--etc-kubernetes-kubelet.conf]: /etc/kubernetes/kubelet.conf already exists
[ERROR Port-10250]: Port 10250 is in use
[ERROR FileAvailable--etc-kubernetes-pki-ca.crt]: /etc/kubernetes/pki/ca.crt already exists
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher
ubuntu@node:~$ sudo kubeadm reset
[reset] WARNING: Changes made to this host by 'kubeadm init' or 'kubeadm join' will be reverted.
[reset] Are you sure you want to proceed? [y/N]: y
[preflight] Running pre-flight checks
W0306 15:36:04.941720 16518 removeetcdmember.go:79] [reset] No kubeadm config, using etcd pod spec to get data directory
[reset] No etcd config found. Assuming external etcd
[reset] Please, manually reset etcd to prevent further issues
[reset] Stopping the kubelet service
[reset] Unmounting mounted directories in "/var/lib/kubelet"
[reset] Deleting contents of config directories: [/etc/kubernetes/manifests /etc/kubernetes/pki]
[reset] Deleting files: [/etc/kubernetes/admin.conf /etc/kubernetes/kubelet.conf /etc/kubernetes/bootstrap-kubelet.conf /etc/kubernetes/controller-manager.conf /etc/kubernetes/scheduler.conf]
[reset] Deleting contents of stateful directories: [/var/lib/kubelet /var/lib/dockershim /var/run/kubernetes /var/lib/cni]
The reset process does not clean CNI configuration. To do so, you must remove /etc/cni/net.d
The reset process does not reset or clean up iptables rules or IPVS tables.
If you wish to reset iptables, you must do so manually by using the "iptables" command.
If your cluster was setup to utilize IPVS, run ipvsadm --clear (or similar)
to reset your system's IPVS tables.
The reset process does not clean your kubeconfig files and you must remove them manually.
Please, check the contents of the $HOME/.kube/config file.
ubuntu@node:~$ sudo kubeadm join 192.168.241.92:6443 --token cn1jrh.nmkfl966puecshrz --discovery-token-ca-cert-hash sha256:9bb6bcec1f1649d04908fa2987ec7d918de0a939df247cb5eb5fb25fe6349c05
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
[preflight] Reading configuration from the cluster...
[preflight] FYI: You can look at this config file with 'kubectl -n kube-system get cm kubeadm-config -o yaml'
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Starting the kubelet
[kubelet-start] Waiting for the kubelet to perform the TLS Bootstrap...
This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.
Run 'kubectl get nodes' on the control-plane to see this node join the cluster.
마찬가지로 Master인 control plane이 클러스터를 실행 하지 못했다면
kubeadm reset
kubeadm init
을 통해서 새롭게 시작 할 수있다.
꼭,
www.weave.works/docs/net/latest/kubernetes/kube-addon/
네트워크 addon을 넣어야 한다는 것을 잊지 말아야 한다.
728x90
반응형
'Software활용' 카테고리의 다른 글
kubeadm join 실패 (2) | 2021.03.08 |
---|---|
Ubuntu에 Python 3.7 Install 하기 (0) | 2021.03.07 |
kubernetes install on ubuntus with Hyper-V (0) | 2021.03.04 |
Kubernetes Deployments No resources (0) | 2021.03.01 |
ssh key를 이용한 github 접근 (0) | 2021.03.01 |