์ฟ ๋ฒ๋คํฐ์ค ๋ฒ์ :
ํด๋ผ์ด์ธํธ ๋ฒ์ : version.Info{์ฃผ:"1", ๋ถ:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState::"clean", BuildDate-0401-211 25Z", GoVersion:"go1.7.4", ์ปดํ์ผ๋ฌ:"gc", ํ๋ซํผ:"darwin/amd64"}
์๋ฒ ๋ฒ์ : version.Info{์ฃผ:"1", ๋ถ:"5", GitVersion:"v1.5.3", GitCommit:"029c3a408176b55c30846f0faedf56aae5992e9b", GitTreeState:"clean", BuildDate:"23145T 56Z", GoVersion:"go1.7.4", ์ปดํ์ผ๋ฌ:"gc", ํ๋ซํผ:"linux/amd64"}
๋ง์คํฐ ๋ฐ ๋ฏธ๋์ธ์ Docker ๋ฒ์ :
$ ๋์ปค -v
Docker ๋ฒ์ 1.13.1, ๋น๋ 092cba3
ํ๊ฒฝ :
uname -a
):๋๊ตฌ ์ค์น :
kubeadm
๊ธฐํ :
๋ฌด์จ ์ผ์ด ์์๋์ง :
kubeadm ํ์ด์ง๋ฅผ ์ฌ์ฉํ์ฌ 3๋
ธ๋ ํด๋ฌ์คํฐ๋ฅผ ์ค์นํ์ต๋๋ค.
$ kc describe nodes | awk '/Addresses/ {print $2}' | awk -F',' '{print $3}'
knode-0
knode-1
knode-master
์ค์น๋ ์ดํ ํฌ๋ ๋คํธ์ํฌ:
kubectl create -f https://raw.githubusercontent.com/tigera/canal/master/k8sinstall/kubeadm/canal.yaml
์ด๋ ๋ ธ๋, ์๋น์ค, ํฌ๋๋ ์ ์์ด์์ต๋๋ค. ๊ทธ๋์ ๋์๋ณด๋๋ก ์ด๋
kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml
$ kubectl get -n kube-system services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
canal-etcd 10.96.232.136 <none> 6666/TCP 5m
kube-dns 10.96.0.10 <none> 53/UDP,53/TCP 13h
kubernetes-dashboard 10.110.163.186 <nodes> 80:31699/TCP 1m
์์ํ๋ ์ผ :
Services doc์ nodePort ์น์
์ nodePort๊ฐ ๋ชจ๋ nodeIP์์ ๋ณด์ฌ์ผ ํจ์ ๋ํ๋
๋๋ค.
์ ๊ฒฝ์ฐ์๋ ๋ชจ๋ nodeIP๊ฐ ๋์๋ณด๋์ nodePort 31699์ ๋ํ ์์ฒญ์ ์๋ตํ๊ณ ์ด๋ฅผ ๋์๋ณด๋ ํฌ๋๋ก ์ ๋ฌํ๋ ๊ฒ์ ์๋๋๋ค.
ํฌ๋๋ฅผ ํธ์คํ
ํ๋ ๋
ธ๋(๋๋ ๋ฏธ๋์ธ)๋ง ๋ธ๋ผ์ฐ์ ์์ฒญ์ ์๋ตํ๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ๋ค๋ฅธ ๋
ธ๋(๋๋ ๋ฏธ๋์ธ)๋ ์๋ตํ์ง ์์ต๋๋ค.
์ฌํํ๋ ๋ฐฉ๋ฒ (๊ฐ๋ฅํ ํ ์ต์ํ์ผ๋ก ๊ทธ๋ฆฌ๊ณ ์ ํํ๊ฒ):
_knode-1(๋ฏธ๋์ธ)์์:_
$ sudo docker ps -a | grep dashboard
79e23eff2c26 gcr.io/google_containers/kubernetes-dashboard-amd64:v1.5.1 "/dashboard --port..." 44 minutes ago Up 43 minutes
_ํด๋ฌ์คํฐ ์ธ๋ถ์ ๋์๋ณด๋์ ๋ํ ์ปฌ ์ก์ธ์ค:_
_knode-0:31699์ ๋ํ ์ฐ๊ฒฐ ์๊ฐ์ด ์ด๊ณผ๋์์ต๋๋ค.
$ curl -m 2 -O http://knode-0:31699/#/workload?namespace=default
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0curl: (28) Connection timed out after 2003 milliseconds
knode-1:31699์์ ์ฑ๊ณต์ ์ผ๋ก ๋ค์ด๋ก๋๋์์ต๋๋ค.
$ curl -m 2 -O http://knode-1:31699/#/workload?namespace=default
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 811 100 811 0 0 18097 0 --:--:-- --:--:-- --:--:-- 18431
*iptables * :
_knode-1์์ (nodePort 31699 ์ก์ธ์ค ๊ฐ๋ฅ):_
$ sudo iptables-save | grep dashboard
-A KUBE-NODEPORTS -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp --dport 31699 -j KUBE-MARK-MASQ
-A KUBE-NODEPORTS -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp --dport 31699 -j KUBE-SVC-XGLOHA7QRQ3V22RZ
-A KUBE-SEP-4CN2KLL64AIMJOUC -s 192.168.92.6/32 -m comment --comment "kube-system/kubernetes-dashboard:" -j KUBE-MARK-MASQ
-A KUBE-SEP-4CN2KLL64AIMJOUC -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp -j DNAT --to-destination 192.168.92.6:9090
-A KUBE-SERVICES -d 10.110.163.186/32 -p tcp -m comment --comment "kube-system/kubernetes-dashboard: cluster IP" -m tcp --dport 80 -j KUBE-SVC-XGLOHA7QRQ3V22RZ
-A KUBE-SVC-XGLOHA7QRQ3V22RZ -m comment --comment "kube-system/kubernetes-dashboard:" -j KUBE-SEP-4CN2KLL64AIMJOUC
_knode-0์์(nodePort 31699 ์ก์ธ์ค ๋ถ๊ฐ):_
$ sudo iptables-save | grep dashboard
-A KUBE-NODEPORTS -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp --dport 31699 -j KUBE-MARK-MASQ
-A KUBE-NODEPORTS -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp --dport 31699 -j KUBE-SVC-XGLOHA7QRQ3V22RZ
-A KUBE-SEP-4CN2KLL64AIMJOUC -s 192.168.92.6/32 -m comment --comment "kube-system/kubernetes-dashboard:" -j KUBE-MARK-MASQ
-A KUBE-SEP-4CN2KLL64AIMJOUC -p tcp -m comment --comment "kube-system/kubernetes-dashboard:" -m tcp -j DNAT --to-destination 192.168.92.6:9090
-A KUBE-SERVICES -d 10.110.163.186/32 -p tcp -m comment --comment "kube-system/kubernetes-dashboard: cluster IP" -m tcp --dport 80 -j KUBE-SVC-XGLOHA7QRQ3V22RZ
-A KUBE-SVC-XGLOHA7QRQ3V22RZ -m comment --comment "kube-system/kubernetes-dashboard:" -j KUBE-SEP-4CN2KLL64AIMJOUC
๊ธฐํ ์์์ผ ํ ์ฌํญ:
RHEL 7.3์์ ๋์ผํ ๋์์ ์ฌํํ ์ ์์ต๋๋ค.
๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.
iptables -P FORWARD ACCEPT
๋ฅผ ์คํํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ docker v1.13.1๊ณผ ํตํฉํ ๋ ๋ฒ๊ทธ์ธ์ง ํ์คํ์ง ์์ต๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๊ฐ์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ต๋๋ค.
iptables -P FORWARD ACCEPT
๋ฅผ ์คํํ๋ฉด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ docker v1.13.1๊ณผ ํตํฉํ ๋ ๋ฒ๊ทธ์ธ์ง ํ์คํ์ง ์์ต๋๋ค.