sudo apt-get update
# apt-transport-https may be a dummy package; if so, you can skip that package
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
# If the directory `/etc/apt/keyrings` does not exist, it should be created before the curl command, read the note below.
# sudo mkdir -p -m 755 /etc/apt/keyrings
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
# This overwrites any existing configuration in /etc/apt/sources.list.d/kubernetes.list
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
sudo systemctl enable --now kubelet
#apt 업데이트
sudo apt-get update
#필수 패키지 설치
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
# docker 설치
sudo apt-get install -y docker.io
#/etc/docker 디렉토리 없을 경우 생성
sudo mkdir /etc/docker
#daemon.json 파일 추가
sudo cat <<EOF | sudo tee /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
https://v1-29.docs.kubernetes.io/docs/setup/production-environment/container-runtimes/#containerd
#containerd 구성 파일 생성
sudo mkdir -p /etc/containerd
#containerd 기본 설정값으로 config.toml 생성
sudo containerd config default | sudo tee /etc/containerd/config.toml
#config.toml 파일 수정
vi /etc/containerd/config.toml
# cgroup driver(runc) 사용하기 설정
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
...
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
sandbox 이미지 설정에 주소를 수정안하면 kubelet이 안올라옴
사내 repository로 push 한 주소로 설정
[plugins."io.containerd.grpc.v1.cri"]
sandbox_image = "xxx.xxx.xxx/registry.k8s.io/pause:3.2"
#수정사항 적용 및 재실행
sudo systemctl restart containerd
kubeadm init --control-plane-endpoint api-int.c3c.clouz.io:6443 --upload-certs --pod-network-cidr 10.130.0.0/16 --image-repository [container registry address]/registry.k8s.io
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
https://kubernetes.io/docs/concepts/cluster-administration/addons/
You can now join any number of the control-plane node running the following command on each as root:
kubeadm join api-int.c3c.clouz.io:6443 --token hmu39d.8x3uxll8msj6s1iq \
--discovery-token-ca-cert-hash sha256:024d933d1a4151be59d4b233c307385dfc70deb87b7d0f226783f5b0c3fc9959 \
--control-plane --certificate-key a2ebfdadd50c3213b495be5747fe8861250ee4b69a1a3eec3318e6e347fde2b3
Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
"kubeadm init phase upload-certs --upload-certs" to reload certs afterward.
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join api-int.c3c.clouz.io:6443 --token hmu39d.8x3uxll8msj6s1iq \
--discovery-token-ca-cert-hash sha256:024d933d1a4151be59d4b233c307385dfc70deb87b7d0f226783f5b0c3fc9959
kubeadm join api-int.c3c.clouz.io:6443 --token hmu39d.8x3uxll8msj6s1iq \
--discovery-token-ca-cert-hash sha256:024d933d1a4151be59d4b233c307385dfc70deb87b7d0f226783f5b0c3fc9959 \
--control-plane --certificate-key a2ebfdadd50c3213b495be5747fe8861250ee4b69a1a3eec3318e6e347fde2b3
curl https://raw.githubusercontent.com/projectcalico/calico/v3.28.0/manifests/calico.yaml -O
spec:
template:
spec:
initContainers:
# This container performs upgrade from host-local IPAM to calico-ipam.
# It can be deleted if this is a fresh installation, or if you have already
# upgraded to use calico-ipam.
- name: upgrade-ipam
image: docker.io/calico/cni:v3.28.0
...
- name: install-cni
image: ecr.clouz.io/dockerhub/calico/cni:v3.28.0
...
- name: "mount-bpffs"
image: ecr.clouz.io/dockerhub/calico/node:v3.28.0
...
- name: calico-node
image: ecr.clouz.io/dockerhub/calico/node:v3.28.0
...
containers:
- name: calico-node
image: ecr.clouz.io/dockerhub/calico/node:v3.28.0
...
env:
- name: CALICO_IPV4POOL_CIDR
value: "10.130.0.0/16"
kubectl apply -f calico.yaml
RKE2 클러스터 구축 (0) | 2024.10.25 |
---|---|
[Kubernetes]권한관리 (role, rbac 등) (0) | 2022.11.21 |
Elastic Cloud on Kubernetes 설치 (0) | 2022.10.23 |
RBAC Authorization (0) | 2021.10.20 |
K8S ingress에 대하여 (0) | 2021.06.24 |
댓글 영역