티스토리 뷰

MLOps

K8S Install

문타리 2025. 3. 14.

Kubernetes Install (kubeadm)

Multi Node 환경 구성 시 kubeadm init 시 출력되는 kubeadm join 명령어를 실행하면 됨

Single Node 환경이므로 control-planetaint 설정 해제 필요

KUBE_DETAIL_VER=1.30.3
POD_NETWORK_CIDR="20.0.0.0/16"
SVC_NETWORK_CIDR="25.0.0.0/16"

kubeadm init --pod-network-cidr=$POD_NETWORK_CIDR --service-cidr=$SVC_NETWORK_CIDR --kubernetes-version=v$KUBE_DETAIL_VER

# Worker Node - Kubeadm Join
# kubeadm join 10.178.0.31:6443 --token fq6hxy.6qugta914hmgr0vm \
#         --discovery-token-ca-cert-hash sha256:2e5b7fb2b7dd23c14ed61d14e3ee44a201fa991eedf594c7ba1377b67c0ce57b 

# kubectl 설정
rm -rf /root/.kube
mkdir -p /root/.kube
cp -i /etc/kubernetes/admin.conf /root/.kube/config
chown root:root /root/.kube/config
export KUBECONFIG=/root/.kube/config
 
echo "source <(kubectl completion bash)" >> ~/.bashrc
echo "alias k=kubectl" >> ~/.bashrc
echo "complete -o default -F __start_kubectl k" >> ~/.bashrc
source ~/.bashrc
source /etc/profile.d/bash_completion.sh
 
kubectl get no
kubectl get po -A -o wide


# Single Node 를 위한 설정
kubectl taint nodes $(hostname) node-role.kubernetes.io/control-plane:NoSchedule-

CNI Install (Cilium)

Single Node 환경이므로 cilium-operator replica 수 1로 조정

# Cilium Install
# helm uninstall -n kube-system cilium
cd /root/files/cilium
helm upgrade --install cilium cilium-1.16.4.tgz \
  --namespace kube-system \
  --set ipam.operator.clusterPoolIPv4PodCIDRList=$POD_NETWORK_CIDR \
  --set ipam.operator.clusterPoolIPv4MaskSize=24 \
  --set socketLB.hostNamespaceOnly=true \
  --set cni.exclusive=false \
  --set hubble.relay.enabled=true \
  --set hubble.ui.enabled=true


# Single Node 를 위한 설정
kubectl scale deployment cilium-operator --replicas=1 -n kube-system
sleep 5;

cilium status --wait

kubectl logs -n kube-system -l k8s-app=kube-proxy --tail=100 | grep Node
kubectl -n kube-system exec ds/cilium -- cilium-dbg status --verbose | grep Services: -A 5

NFS Provisioner Install

NFS_IP=$(hostname -I | awk '{print $1}')
sudo showmount -e $NFS_IP

cd /root/files/nfs
helm install kf-nfs nfs-subdir-external-provisioner-4.0.18.tgz \
    --set nfs.server=$NFS_IP \
    --set nfs.path=/nfs/kf \
    --namespace kf-nfs --create-namespace
 
kubectl get sc
kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
kubectl get sc

'MLOps' 카테고리의 다른 글

K8S Node GPU Driver Install  (0) 2025.03.14
K8S Node Pre Install (Offline)  (0) 2025.03.14
K8S Node Pre Install (Online)  (0) 2025.03.11
MLOps 실습환경 구축 - GCP  (0) 2025.03.11
MLOps 실습환경 구축 - GCP (with. Terraform)  (0) 2025.03.11
댓글