K8S Cluster basic setups

sh5·2024년 9월 12일
0
  • ingress-nginx-controller
  • local-path-provisioner
  • metallb

이 3개를 설치하는 bash 스크립트

#!/bin/bash

# INSTALL::local-path-provisioner
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.20/deploy/local-path-storage.yaml

# change default storage class
kubectl patch storageclass local-path  -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'


# INSTALL::metallb
helm repo add metallb https://metallb.github.io/metallb
helm install metallb metallb/metallb -n metallb-system --create-namespace

# setup metallb
cat << EOF > ip-pool.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
  name: default
  namespace: metallb-system
spec:
  addresses:
  - 192.168.10.0/24
  autoAssign: true
EOF

cat << EOF > l2-network.yaml
apiVersion: metallb.io/v1beta1
kind: L2Advertisement
metadata:
  name: l2-network
  namespace: metallb-system
spec:
  ipAddressPools:
    - metallb-ippool
EOF

sleep 5
kubectl create -f ip-pool.yaml -f l2-network.yaml


# INSTALL::ingress nginx controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.11.2/deploy/static/provider/baremetal/deploy.yaml

# change service type of ingress-nginx-controller
kubectl patch service ingress-nginx-controller -n ingress-nginx -p '{"spec": {"type": "LoadBalancer"}}'

0개의 댓글