본 글은 kubernetes | vagrant and docker 글에서 이어집니다.
https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository 내용을 참고해서 설치합니다.

docker 설치

$ sudo apt-get update

$ sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

docker offical GPG key. 등록

$ sudo mkdir -p /etc/apt/keyrings

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

repository 추가

$ echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

docker-engine 설치

$ sudo apt-get update

$ sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin
$ sudo systemctl enable docker
$ sudo systemctl start docker

kubenetes 설치

사전준비 사항

  1. 환경설정
  2. kubeaadm, kubectl, kubelet 설치
  3. control-plane 구성
  4. worker node 구성
  5. 설치확인

1, swap 제거

스왑의 비활성화. kubelet이 제대로 작동하게 하려면 반드시 스왑을 사용하지 않도록 설정한다

$ swapoff -a && sed -i '/swap/s/^/#/' /etc/fstab

2. iptables가 브리지된 트래픽을 보게 하기

Letting iptables see bridged traffic

$ cat <<EOF | tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF

$ cat <<EOF | tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

$ sudo sysctl --system

3. 방화벽 설정

앞단에 방화벽이 대부분 존재합니다. 방화벽을 끄고 사용하도록 합니다.

$ systemctl stop firewalld 
$ systemctl disable firewalld

selinux disabled 설정

4) Set SELinux in permissive mode (effectively disabling it)
# setenforce 0
# sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

kubeadm, kubelet, kubectl 설치


$ sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

$ echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | 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

3. Initializing your control-plane node

$ kubeadm init -- 옵션들
[init] Using Kubernetes version: v1.24.1
[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
        [ERROR CRI]: container runtime is not running: output: E0531 14:39:51.155826   27989 remote_runtime.go:925] "Status from runtime service failed" err="rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
time="2022-05-31T14:39:51Z" level=fatal msg="getting status of runtime: rpc error: code = Unimplemented desc = unknown service runtime.v1alpha2.RuntimeService"
, error: exit status 1
[preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...`
To see the stack trace of this error execute with --v=5 or higher

에러가 발생했습니다. 아래와 같이 설정파일 날리고 재실행하니 문제가 없었습니다.

unknown service runtime.v1alpha2.RuntimeService 과 같은 오류가 발생하게 되면 컨테이너 런타임에서 CRI 기능을 비활성화 한 경우이므로 다음 추가 작업을 진행합니다.
전체 master, node1, node2 에서

$ rm /etc/containerd/config.toml
# 아니면 안에 cri 내용을 주석처리 한다.
$ sudo systemctl restart containerd

가상환경에서는 --apiserver-advertise-address옵션을 줘야 192.168.56.xxx 으로 통신을 할 수 있습니다.

calico 기반

$ ubeadm init --apiserver-advertise-address=10.0.0.10 --pod-network-cidr=192.168.0.0/16

flannel 기반

(Master)$ sudo kubeadm init --apiserver-advertise-address=192.168.56.100 --pod-network-cidr=10.244.0.0/16

kubeadm를 초기화 한다. –pod-network-cidr는 반드시 10.244.0.0/16으로 설정해야 한다. Docker Version으로 인한 Error가 발생하면 kubeadm init 마지막에 '–ignore-preflight-errors=SystemVerification'를 붙인다.

아래와 같은 로그들이 출력 된다.

[init] Using Kubernetes version: v1.24.1
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local master] and IPs [10.96.0.1 10.0.2.15]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost master] and IPs [10.0.2.15 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost master] and IPs [10.0.2.15 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 10.507423 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node master as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node master as control-plane by adding the taints [node-role.kubernetes.io/master:NoSchedule node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: 39tu9f.zvo7sn8r11613q4u
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

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/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 192.168.56.10:6443 --token 39tu9f.zvo7sn8r11613q4u \
        --discovery-token-ca-cert-hash sha256:a5ff918cb85ae91f474f8b49b7b3c2047c9eaa9be158c6cc470a382b7e3f9aee

controller, schedular, etcd 등이 생성된다.
node들에서 master와 연결을 하기 위해서는 token 정보를 알고 있어야 합니다.
아래는 예시입니다. 테스트기기 마다ㅏ 값이 다르기 때문에 메모할 필요가 있습니다

$ kubeadm join 192.168.56.10:6443 --token 39tu9f.zvo7sn8r11613q4u \
        --discovery-token-ca-cert-hash sha256:a5ff918cb85ae91f474f8b49b7b3c2047c9eaa9be158c6cc470a382b7e3f9aee

pod network

master에서만 실행

weave 계열

$ kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
ARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
serviceaccount/weave-net created
clusterrole.rbac.authorization.k8s.io/weave-net created
clusterrolebinding.rbac.authorization.k8s.io/weave-net created
role.rbac.authorization.k8s.io/weave-net created
rolebinding.rbac.authorization.k8s.io/weave-net created
daemonset.apps/weave-net created

flannel 설치

--pod-network-cidr=10.244.0.0/16 들 추가한다.

$ kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml

vagrant network 에러

-- https://github.com/k3s-io/k3s/issues/72 에서 해결책을 찾음

$ wget https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
$ vi kube-flannel.yml
수정

  containers:
      - name: kube-flannel
        image: quay.io/coreos/flannel:v0.10.0-amd64
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        - --iface=enp0s8

자동완성 설정

# setup autocomplete in bash into the current shell, bash-completion package should be installed first.
$ source <(kubectl completion bash) 
# add autocomplete permanently to your bash shell.
$ echo "source <(kubectl completion bash)" >> ~/.bashrc
$ source ~/.bashrc

root 에서 안 error가 발생할 시 아래 내용을 /etc/bash.bashrc에 넣습니다. log out 후에 재접속 하면 반영 되는 것을 확인 할 수 있습니다.

echo 'if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi' >> /etc/bash.bashrc

master node에서도 pod이 생성 되게 설정

# kubectl taint nodes --all node-role.kubernetes.io/control-plane- node-role.kubernetes.io/master-

dashboard 설치

https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ 에 최신버전을 확인해nr 사용하도록 한다.

(Master)# kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml

localhost:8080 error

worker node에서는 에러가 난다.. 모든 설정은 node1에서 되고 있으니 문제가 없어영

유용한 참조 블로그

https://ssup2.github.io/record/Kubernetes_%EC%84%A4%EC%B9%98_kubeadm_Ubuntu_18.04/

  • CNI 네트워크 설정을 해결하는데 큰 도움이 됨
반응형

'개발 > 가상화' 카테고리의 다른 글

Apache Mesos, Kubernetes 비교  (0) 2022.09.15
docker | error : Failed to get D-Bus connection: Operation not permitted  (0) 2022.07.14
kubenetes | vagrant 로 구성하기  (0) 2022.07.06
kubernetes | command  (0) 2022.07.05
XCP-ng Tools 설치  (0) 2018.11.29

kubernetes 환경을 로컬에 구성하기 위해서 virtualbox + vagrant 조합으로 쿠버네티스 구성을 만들어 보려고 합니다. 개발환경은 맥을 사용하기 때문에 homebrew를 통해서 설치하려고 합니다.

virtualboxvagrant를 설치합니다.

vagrantvirtualbox 를 관리하고 설정을 스크립트로 저장해서 사용할 수 있게 해주는 툴입니다. 간단한 for반복문을 통해서 어려대의 서버를 한꺼번에 생성할 수 있습니다. (병렬 생성은 아니고, 한개씩한개씩 생성합니다.)

1. virtual machine 준비

1.1. virtualbox, vagrant 설치

$ brew install virtualbox vagrant

Vagrantdocker-compose와 같이 폴더 안에 vagrantfile 파일을 통해서 virtualBox를 제어합니다.

1.1. OS 준비

이번에는 우분투를 사용해서 구성해 보려고 합니다. 지속적으로 업데이트되고있는 ubuntu 이미지를 사용했습니다. (개인적으로 레드햇계열을 사용하는데, 이미지가 안보여서 Debian 계열로 설치해 봤습니다.)

https://app.vagrantup.com/ubuntu/boxes/focal64 에 들어가면 vagrantfile에 들어가는 설정을 확인할 수 있습니다.

1.1.1. vagrantfile 생성

vagrant init 명령어를 통해서 vagrantfile파일을 생성합니다.

$ vagrant init ubuntu/focal64
$ vagrant up

아래는 vmware 기본설정안에 들어가는 내용입니다.

file ... vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/focal64"
end

1.1.2. 쿠터네티스 구성

쿠터네티스는 아래와 같이 구성하려고 합니다.
설정을 할 때에 network 옵션을 추가해서 노드간 네트워크를 구성합니다.

  • master x1
  • node x2

가상머신을 구성할 때 node.vm.provision 옵션을 통해서 docker를 기본 설치하도록 설정할 수 있습니다.

vagrantfile을 통해서 n개의 node를 만들 수 있습니다. for문을 사용할 수 있습니다.
서버의 cpu, memory 제한에 대해서 설정을 할 수 있지만, 테스트로 사용하는 것이기 때문에 디테일한 설정을 사용하지 않겠습니다.

file ... vagrantfile

Vagrant.configure("2") do |config|
    config.vm.define "master" do |master|
        master.vm.box = "ubuntu/focal64"
        master.vm.network "private_network", ip: "192.168.56.100"
        master.vm.hostname = "master"
        master.vm.provision "docker"
    end

    config.vm.define "node1" do |node1|
        node1.vm.box = "ubuntu/focal64"
        node1.vm.network "private_network", ip: "192.168.56.101"
        node1.vm.hostname = "node1"
        node1.vm.provision "docker"
    end

    config.vm.define "node2" do |node2|
        node2.vm.box = "ubuntu/focal64"
        node2.vm.network "private_network", ip: "192.168.56.102"
        node2.vm.hostname = "node2"
        node2.vm.provision "docker"
end

1.1.3. virtualbox 실행

$ vagrant up

1.1.4. ssh 접속

config.vm.define 되어 있는 정보를 통해서 ssh접속을 할 수 있습니다.

$ vagrant ssh master

1.1.5. 쿠버네티스 설치를 위한 자동 구성

쿠버네티스 설치를 위한 bash 항목 입니다. 해당 내용은 https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/ 에서 확인할 수 있습니다. 저는 그 내용을 모았습니다.

# /bin/bash
sudo swapoff -a
sudo sed -i '/swap/d' /etc/fstab
sudo apt-get update
sleep 1

sudo apt-get install -y ca-certificates apt-transport-https curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sleep 1

sudo apt-get install -y docker-ce=$docker_ver docker-ce-cli=$docker_ver containerd.io
sudo systemctl enable docker
sudo systemctl start docker

# First Permission
sudo mkdir /etc/docker
# sudo chown $USER:docker /etc/docker

# Setup daemon.
sudo cat > /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

sudo mkdir -p /etc/systemd/system/docker.service.d

sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
sudo modprobe br_netfilter
cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF

sudo sysctl --system

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sleep 1

sudo apt-get install -y kubelet=$k8s_ver kubeadm=$k8s_ver kubectl=$k8s_ver
sudo apt-mark hold kubelet kubeadm kubectl

network 설정

vagrant 로 kubernetes설정 시 네트워크 문제가 발생합니다.
아래 명령을통해서 network 설정을 등록한다.

--node-ip에 등록되는 IP는 해당 node의 IP 를 말합니다. vagrant를 통해서 설치하면, 네트워크가 enp0s8vagrantfile에 설정되어 있는 IP로 할당되어있는 것을 확인할 수 있습니다.

$ echo "Environment=\"KUBELET_EXTRA_ARGS=--node-ip=192.168.56.101\"" >> /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
$ systemctl daemon-reload
$ systemctl restart kubelet
[Service]
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
EnvironmentFile=-/etc/default/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
Environment="KUBELET_EXTRA_ARGS=--node-ip=192.168.56.101"

docker ps 가 아무것도 안 나올때

쿠버네티스 구성을 끝냈지만, docker ps에서는 아무런 정보도 확인할 수 없을 때, 아래 명령어를 통해서 돌아가고 있는 것을 확인할 수 있습니다.
crictl는 디버깅 툴이지만, docker의 상태를 확인할 때도 유용합니다.

$ sudo crictl pods

본 글은 kubernetes 설치 항목에 이어집니다.

반응형

기본형식

$ kubectl [command] [type] [name] [flags]

COMMAND

  • create
  • get
  • delete
  • edit

TYPE

자원의 타입

  • node
  • pod
  • service

NAME

마음대로 수정가능

예) webserver,

FLAG

부가적인 설정을 할 수 있음.
--help, -o options 등으로 입력할 수 있음.

root@master:/home/vagrant# kubectl get node
NAME     STATUS   ROLES           AGE   VERSION
master   Ready    control-plane   37m   v1.24.1
node1    Ready    <none>          36m   v1.24.1
node2    Ready    <none>          36m   v1.24.1
$ kubectl get node -o wide
NAME     STATUS   ROLES           AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
master   Ready    control-plane   40m   v1.24.1   10.0.2.15     <none>        Ubuntu 20.04.4 LTS   5.4.0-113-generic   containerd://1.6.4
node1    Ready    <none>          39m   v1.24.1   10.0.2.15     <none>        Ubuntu 20.04.4 LTS   5.4.0-113-generic   containerd://1.6.4
node2    Ready    <none>          38m   v1.24.1   10.0.2.15     <none>        Ubuntu 20.04.4 LTS   5.4.0-113-generic   containerd://1.6.4
$ kubectl describe nodes master
$ kubectl run webserver --image:nginx:1.14 --port 80
pod/webserver created

# pod 정보확인

$ kubectl describe pod webserver

상세정보로 현재 실행상태를 파악할 수 있습니다.
자세히 살펴보니 네트워크 설정 오류로 판단되어 kubeadm 으로 리셋 후 다시 설정하기로 하였다.

$ kubeadm reset 
$ systemctl restart kubelet

# 2. cni 관련 디렉토리 파일 삭제(마스터에서만)
$ rm -rf /etc/cni/net.d/*
$ rm -rf $HOME/.kube/config
반응형

2년동안 gitlab을 운영하면서 한번도 업그레이드를 하지 않았습니다. gitlab.com 사이트에서는 계속 신기술과 최적화가 이뤄지도 있었지만, 온프로미스에 설치되어 있는 사내 gitlab은 새로운 시대에 적응을 못하고 있었습니다. 그래서, 이번에 버전업을 진행하면서 작업 방법에 대해서 글을 남깁니다.

gitlab 은 업그레이드 주요버전을 넘어서 업그레이드 할 수 없습니다. 설치하려고해도 설치완료 되었다는 메세지를 확인할 수 없습니다. 아래와 같은 메세지 Complete!라는 메세지와 로고가 나와야 합니다.

gitlab Reconfigured!
Restarting previously running GitLab services
ok: run: alertmanager: (pid 29637) 0s
ok: run: gitaly: (pid 9202) 7121s
ok: run: gitlab-exporter: (pid 29649) 0s
ok: run: gitlab-kas: (pid 29612) 1s
ok: run: gitlab-workhorse: (pid 29623) 1s
ok: run: grafana: (pid 29653) 1s
ok: run: logrotate: (pid 29663) 0s
ok: run: nginx: (pid 29672) 1s
ok: run: node-exporter: (pid 29683) 0s
ok: run: postgres-exporter: (pid 29689) 1s
ok: run: postgresql: (pid 1562) 9127s
ok: run: prometheus: (pid 29707) 0s
ok: run: puma: (pid 29794) 0s
ok: run: redis: (pid 8759) 7201s
ok: run: redis-exporter: (pid 29800) 1s
ok: run: sidekiq: (pid 29807) 0s

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
The automatic database backup was skipped as requested.
You may enable it again anytime by running the following command:
  sudo rm /etc/gitlab/skip-auto-backup

  Verifying  : gitlab-ce-14.10.4-ce.0.el7.x86_64                                                                                                      1/2
  Verifying  : gitlab-ce-14.9.5-ce.0.el7.x86_64                                                                                                       2/2

Updated:
  gitlab-ce.x86_64 0:14.10.4-ce.0.el7

Complete!

1. 준비

1.1. 백업

원복하기 위한 작업입니다. 2년 넘게 작업해온 내역들이 날아갈 수 있습니다. 내용을 작성하면서 다시 한번 백업을 진행했습니다. 백업은 자주 해 주시면 좋습니다. 기왕이면 crontab을 사용해서 작성하시기 바랍니다.

$ gitlab-backup create
2022-07-05 23:04:05 +0900 -- Dumping repositories ... done
2022-07-05 23:04:05 +0900 -- Dumping uploads ...
2022-07-05 23:04:06 +0900 -- Dumping uploads ... done
2022-07-05 23:04:06 +0900 -- Dumping builds ...
2022-07-05 23:04:06 +0900 -- Dumping builds ... done
2022-07-05 23:04:06 +0900 -- Dumping artifacts ...
2022-07-05 23:04:06 +0900 -- Dumping artifacts ... done
2022-07-05 23:04:06 +0900 -- Dumping pages ...
2022-07-05 23:04:06 +0900 -- Dumping pages ... done
2022-07-05 23:04:06 +0900 -- Dumping lfs objects ...
2022-07-05 23:04:06 +0900 -- Dumping lfs objects ... done
2022-07-05 23:04:06 +0900 -- Dumping terraform states ...
2022-07-05 23:04:06 +0900 -- Dumping terraform states ... done
2022-07-05 23:04:06 +0900 -- Dumping container registry images ... [DISABLED]
2022-07-05 23:04:06 +0900 -- Dumping packages ...
2022-07-05 23:04:06 +0900 -- Dumping packages ... done
2022-07-05 23:04:06 +0900 -- Creating backup archive: 1657029839_2022_07_05_14.10.4_gitlab_backup.tar ...
2022-07-05 23:04:06 +0900 -- Creating backup archive: 1657029839_2022_07_05_14.10.4_gitlab_backup.tar ... done
2022-07-05 23:04:06 +0900 -- Uploading backup archive to remote storage  ... [SKIPPED]
2022-07-05 23:04:06 +0900 -- Deleting tar staging files ...
2022-07-05 23:04:06 +0900 -- Cleaning up /var/opt/gitlab/backups/backup_information.yml
2022-07-05 23:04:06 +0900 -- Cleaning up /var/opt/gitlab/backups/db
2022-07-05 23:04:06 +0900 -- Cleaning up /var/opt/gitlab/backups/repositories
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/uploads.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/builds.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/artifacts.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/pages.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/lfs.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/terraform_state.tar.gz
2022-07-05 23:04:07 +0900 -- Cleaning up /var/opt/gitlab/backups/packages.tar.gz
2022-07-05 23:04:07 +0900 -- Deleting tar staging files ... done
2022-07-05 23:04:07 +0900 -- Deleting old backups ... [SKIPPED]
2022-07-05 23:04:07 +0900 -- Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data
and are not included in this backup. You will need these files to restore a backup.
Please back them up manually.

/var/opt/gitlab/backups 에 백업한 파일들이 있는 것을 확인할 수 있습니다.

1.2. DB 자동 백업 중지

gitlab은 버전업을 하면 DB 또한 버전에 맞춰서 갱신되는 작업을 합니다. 이 부분을 자동으로 갱신되는 것을 방지 합니다. /etc/gitlab폴더에 파일을 생성해 놓으면 gitlab에서 자동으로 백업되는 것을 방지할 수 있습니다.

$ touch /etc/gitlab/skip-auto-backup

2. 업그레이드 작업

2.1. 업그레이드 순서 확인

8.11.Z -> 8.12.0 -> 8.17.7 -> 9.5.10 -> 10.8.7 -> 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.10.14 -> 13.0.14 -> 13.1.11 -> 13.8.8 -> 13.12.15 -> 14.0.12 -> 14.3.6 -> 14.9.5 -> 14.10.Z -> 15.0.Z -> latest 15.Y.Z

여기에 업그레이드 버전에 맞춰서 단계별로 진행해야 합니다. 현재 버전이 중간에 있다면, 그 다음 버전으로 업그레이드 해주면 됩니다.

주의: 한번씩 업그레이드 해 줄때마다 백그라운드 이전작업이 진행 됩니다. 이 부분을 반드시 확인하면서 진행하여야 합니다.
또한 redis 버전, progres 버전 등을 업그레이드 해줘야 하는 경우도 있습니다.

$ yum install gitlab-ce-13.8.8
$ yum install gitlab-ce-13.12.15
$ yum install gitlab-ce-14.0.12

2.2. 업그레이드 전에 백그라운드 업데이트 체크

업그레이드 후에 백그라운드에서 DB 데이터등을 업데이트 하는 작업이 있는지 확인하면서 진행합니다. 작업이 다 끝나지 않았는데 업그레이드를 진행하면 데이터가 깨질 수 있다고 합니다.

2.2.1. bash 명령어로 확인

# 작업 확인
$ sudo gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'
0 # 작업중이면 '1'로 표기

2.2.2. 관리자 화면에서 확인

gitlab을 admin계정으로 접속을 한 후,
[Admin Area] - [Monitoring] - [Background Migrations] 에 들어가면 상단 Queue에 현재 작업 또는 대기중인 내역을 확인할 수 있다.

반응형

캠핑장에서 커피를 마시려고 할때 물을 냄비에 끊여 종이컵으로 따라서 드립을 마셨습니다. 2년 동안 주전자 없이 캠핑을 다녔다니 ..... 계속 주전자를 사려 알아보았지만, 맘에 드는 것이 없었습니다. 사실은 전부다 맘에 들었습니다.

각각 나름을 갬성을 갖고 있습니다.

coleman 주전자

릿지몽키 사각 주전자

많은 캠핑 주전자들을 보았는데, 이것저것 맘에 드는 것들이 많았지만, 선택장애가 오고 말아서 고를 수가 없었다.
결국에 고른게 중국산 ALOCS 제품입니다..

Imgur

1.4L 용량으로 구매했습니다. 얼마나 들어가나 확인을 했는데, 최대로 1400ml 가 들어가기는 합니다.
그러나 주전자의 주댕이 따르는 부분까지 올라옵니다. 이 상태로 물을 끊이면 100% 넘칩니다. 사실상 사용할 수 있는 용량은 1L 정도입니다.

지라프 버너에 물을 1L 끊여봤습니다. 실내에서 물을 끊였는대도 물이 끊어오르는데 5분 정도가 소요됩습니다. 이 부분은 버너 차이로 보입니다. 강염이라면 5분내로 끊었을 것 같습니다.

ImgurImgur

아직 캠핑장에서 사용해보지는 못 했지만, 만족하면서 사용할 것 같습니다.
단, 아이들이 있을경우 물 쏟아지는 것에 대해서 주의 해야 할 것 같습니다.

반응형

+ Recent posts