๐ŸŒฑ Infra/Container_ Kubernetes

[k8s] ERROR - The connection to server was refused

mini_world 2022. 2. 21. 21:40
๋ชฉ์ฐจ ์ ‘๊ธฐ

 

์ •๋ง ์˜ค๋ž˜๊ฐ„๋งŒ์— ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๊ณต๋ถ€ํ•˜๋Š”๋ฐ... ์•„์ฃผ ์˜ค๋ž˜๊ฐ„๋งŒ์ด๋ผ ๋˜ ์˜ค๋งŒ๊ฐ€์ง€ ์˜ค๋ฅ˜ ์‹œ์ž‘์ž…๋‹ˆ๋‹ค ๐Ÿฅฒ.... ์‚ถ์ด๋ž€..์‚ถ์€...๋‹ฌ๊ฑ€์ด๋‹ค...

์˜ค๋ฅ˜๋ฅผ ์‚ดํŽด๋ด…์‹œ๋‹ค.

[root@ip-10-77-110-113 docker]# kubectl run myapp --image=myapp-image --port=8080
The connection to the server localhost:8080 was refused - did you specify the right host or port?

 

์ด ์˜ค๋ฅ˜๋Š” ์ €๋Š” ์ด๋ ‡๊ฒŒ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

1) kube init ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•ด์„œ kubectl ์ดˆ๊ธฐ ์„ค์ •์„ ํ•ด๋ด…์‹œ๋‹ค. ์• ์ดˆ์— kubectl ๋ช…๋ น์–ด๋Š” ๋งˆ์Šคํ„ฐ ๋…ธ๋“œ์—์„œ๋งŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋‹ˆ๊นŒ์š”.!

kubeadm init

2) ์„ค์ •ํŒŒ์ผ์„ ์˜ฎ๊ฒจ์ค์‹œ๋‹ค.

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

์ด์ œ ๋ช…๋ น์–ด ์ž˜ ๋˜๋Š”์ง€ ํ™•์ธํ•ด๋ด…์‹œ๋‹ค.

[root@ip-10-77-110-113 docker]# kubectl run myapp --image=myapp-image --port=8081
pod/myapp created

์˜ค! ์ž˜ ๋ฉ๋‹ˆ๋‹ค!1 ๐Ÿฅณ 
๋ชจ๋‘ ํ™”์ดํŒ…!!

728x90