Closed4
k3d環境にmetallb/nginx ingress controllerを入れて外部からアクセスできるようにする
metallbの用意のため、k3d環境でデフォルトで有効となるtreafikを無効にする
k3d-config.yaml
options:
k3s:
extraArgs:
- arg: "--disable=traefik"
nodeFilters:
- server:*
- arg: "--disable=servicelb"
nodeFilters:
- server:*
ここの通りにやったらうまくいった
ありがたや
$ k get pod -n metallb-system
NAME READY STATUS RESTARTS AGE
controller-54fbfb8495-t8992 1/1 Running 1 (9m7s ago) 83m
speaker-7qhwg 1/1 Running 4 (8m16s ago) 83m
speaker-bn57q 1/1 Running 4 (8m9s ago) 83m
speaker-btjzv 1/1 Running 4 (8m9s ago) 83m
speaker-kt26n 1/1 Running 4 (8m16s ago) 83m
$ k get pod -n ingress-nginx
NAME READY STATUS RESTARTS AGE
ingress-nginx-admission-create-np6nw 0/1 Completed 0 79m
ingress-nginx-admission-patch-f5nzm 0/1 Completed 0 79m
ingress-nginx-controller-5745bf8c79-x4wwq 1/1 Running 1 (9m39s ago) 79m
$ k get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
nginx-ingress nginx hello-world.info 172.19.0.0 80 103s
$ curl hello-world.info
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
できることはわかったのでhelm化する
helm(helmfile)化
できた
helmfile.yaml
repositories:
- name: metallb
url: https://metallb.github.io/metallb
- name: ingress-nginx
url: https://kubernetes.github.io/ingress-nginx
...
releases:
- name: metallb
namespace: metallb-system
chart: metallb/metallb
version: 0.14.8
condition: metallb.enabled
- name: metallb-config
namespace: metallb-system
chart: "./metallb"
condition: metallb.enabled
- name: ingress-nginx
namespace: ingress-nginx
chart: ingress-nginx/ingress-nginx
version: 4.11.2
condition: nginxIngressController.enabled
metallbのconfigは./metallbに入れてhelmfileで管理する
./metallb/metallb-config.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: default
namespace: metallb-system
spec:
addresses:
- 172.19.0.240-172.19.0.249
autoAssign: true
---
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
name: default
namespace: metallb-system
spec:
ipAddressPools:
- default
metallb参考
$ helmfile sync
確認
ヨシ
$ k get pod -n metallb-system
NAME READY STATUS RESTARTS AGE
metallb-controller-76bf5df6db-jjt78 1/1 Running 0 39m
metallb-speaker-47rt6 4/4 Running 0 39m
metallb-speaker-dmgjd 4/4 Running 0 39m
metallb-speaker-nj48h 4/4 Running 0 39m
metallb-speaker-wbfcg 4/4 Running 0 39m
$ k get pod -n ingress-nginx
NAME READY STATUS RESTARTS AGE
ingress-nginx-controller-74d59b4b45-djz22 1/1 Running 0 45m
$ k get ingress
NAME CLASS HOSTS ADDRESS PORTS AGE
nginx-ingress nginx hello-world.info 172.19.0.240 80 24m
$ curl hello-world.info
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
このスクラップは2ヶ月前にクローズされました