MathJax

MathJax-2

MathJax-3

Google Code Prettify

置頂入手筆記

EnterproseDB Quickstart — 快速入門筆記

由於考慮採用 EnterpriseDB 或是直接用 PostgreSQL 的人,通常需要一些入手的資料。這邊紀錄便提供相關快速上手的簡單筆記 ~ 這篇筆記以 資料庫安裝完畢後的快速使用 為目標,基本紀錄登入使用的範例:

2021年9月10日 星期五

K8s in Docker:好心的 K8s 測試環境

K8s 有一大堆的測試環境設置方式,這邊紀錄一個 KIND 專案 — Kubernetes IN Docker — 把在 Docker Container 裡面模擬多節點 K8s 環境。

有別於之前筆記在 LXD 裡面設置 Minikube 得準備一堆預備動作,KIND 蠻好心的~簡簡單單的把 K8s 關在容器裡面~!

這樣一來~測試環境空間省很多,資源也比較省~更比之前辛苦的用 LXD 關住 Minikube 容易多了~


本處準備的 Docker Host 為 CentOS 8Stream,不過基本上用其他 OS 環境的 Docker 也可以。首先安裝 Docker:因為有點忘記,所以回頭參考一下 Install Docker Engine on CentOS | Docker Documentation
[goodgame@k8sindocker ~]$ cat /etc/*release
CentOS Stream release 8
NAME="CentOS Stream"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Stream 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"
CentOS Stream release 8
CentOS Stream release 8
[goodgame@k8sindocker ~]$ sudo yum install -y wget
[goodgame@k8sindocker ~]$ sudo wget -P /etc/yum.repos.d/ https://download.docker.com/linux/centos/docker-ce.repo
[goodgame@k8sindocker ~]$ sudo yum install -y docker-ce docker-ce-cli containerd.io
[goodgame@k8sindocker ~]$ sudo service docker start
[goodgame@k8sindocker ~]$ sudo chkconfig docker on
[goodgame@k8sindocker ~]$ sudo usermod -aG docker $USER
[goodgame@k8sindocker ~]$ newgrp docker
[goodgame@k8sindocker ~]$ docker run --rm hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b8dfde127a29: Pull complete 
Digest: sha256:7d91b69e04a9029b99f3585aaaccae2baa80bcf318f4a5d2165a9898cd2dc0a1
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

[goodgame@k8sindocker ~]$ 

接著就可以安裝 KIND 了:除了 KIND 之外,也需要 kubectl 這個 K8s CLI 元件,才能跟 K8s 叢集互動。安裝步驟可以參考 kind, Kubernetes clusters using Docker – Quick Start,而關於 kubectl 的資訊可以參考這 Install Tools | Kubernetes
[goodgame@k8sindocker ~]$ sudo wget https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64 -P /usr/local/bin/
--2021-09-10 09:41:05--  https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
Resolving kind.sigs.k8s.io (kind.sigs.k8s.io)... 67.207.81.229, 34.194.149.67, 2600:1f18:2489:8202:8b08:4681:8310:cd65, ...
Connecting to kind.sigs.k8s.io (kind.sigs.k8s.io)|67.207.81.229|:443... connected.
GnuTLS: Resource temporarily unavailable, try again.
GnuTLS: Resource temporarily unavailable, try again.
GnuTLS: Resource temporarily unavailable, try again.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-amd64 [following]
--2021-09-10 09:41:05--  https://github.com/kubernetes-sigs/kind/releases/download/v0.11.1/kind-linux-amd64
Resolving github.com (github.com)... 140.82.112.4
Connecting to github.com (github.com)|140.82.112.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-releases.githubusercontent.com/148545807/35090700-bf13-11eb-86f7-457d9d738822?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210910%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210910T094105Z&X-Amz-Expires=300&X-Amz-Signature=69916e14682ecbe451c46392f4cf20c73631307cb1ea644664f7bb950a7d9dff&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=148545807&response-content-disposition=attachment%3B%20filename%3Dkind-linux-amd64&response-content-type=application%2Foctet-stream [following]
--2021-09-10 09:41:05--  https://github-releases.githubusercontent.com/148545807/35090700-bf13-11eb-86f7-457d9d738822?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210910%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210910T094105Z&X-Amz-Expires=300&X-Amz-Signature=69916e14682ecbe451c46392f4cf20c73631307cb1ea644664f7bb950a7d9dff&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=148545807&response-content-disposition=attachment%3B%20filename%3Dkind-linux-amd64&response-content-type=application%2Foctet-stream
Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.108.154, 185.199.109.154, 185.199.110.154, ...
Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.108.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6820758 (6.5M) [application/octet-stream]
Saving to: ‘/usr/local/bin/kind-linux-amd64’

kind-linux-amd64        100%[=============================>]   6.50M  --.-KB/s    in 0.08s   

2021-09-10 09:41:05 (79.8 MB/s) - ‘/usr/local/bin/kind-linux-amd64’ saved [6820758/6820758]

[goodgame@k8sindocker ~]$ sudo chmod +x /usr/local/bin/kind-linux-amd64 
[goodgame@k8sindocker ~]$ kind-linux-amd64 --version
kind version 0.11.1
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ sudo wget "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -P /usr/local/bin/
--2021-09-10 09:41:49--  https://dl.k8s.io/release/v1.22.1/bin/linux/amd64/kubectl
Resolving dl.k8s.io (dl.k8s.io)... 34.107.204.206, 2600:1901:0:26f3::
Connecting to dl.k8s.io (dl.k8s.io)|34.107.204.206|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://storage.googleapis.com/kubernetes-release/release/v1.22.1/bin/linux/amd64/kubectl [following]
--2021-09-10 09:41:49--  https://storage.googleapis.com/kubernetes-release/release/v1.22.1/bin/linux/amd64/kubectl
Resolving storage.googleapis.com (storage.googleapis.com)... 142.250.148.128, 209.85.200.128, 209.85.234.128, ...
Connecting to storage.googleapis.com (storage.googleapis.com)|142.250.148.128|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 46907392 (45M) [application/octet-stream]
Saving to: ‘/usr/local/bin/kubectl’

kubectl                 100%[=============================>]  44.73M   258MB/s    in 0.2s    

2021-09-10 09:41:50 (258 MB/s) - ‘/usr/local/bin/kubectl’ saved [46907392/46907392]

[goodgame@k8sindocker ~]$ sudo chmod +x /usr/local/bin/kubectl
[goodgame@k8sindocker ~]$ kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:45:37Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
[goodgame@k8sindocker ~]$ 

接著就能夠初始化一個 K8s 了:這邊目標是初始化一個 1+2 的 K8s 環境
[goodgame@k8sindocker ~]$ kind-linux-amd64 create cluster --help
Creates a local Kubernetes cluster using Docker container 'nodes'

Usage:
  kind create cluster [flags]

Flags:
      --config string       path to a kind config file
  -h, --help                help for cluster
      --image string        node docker image to use for booting the cluster
      --kubeconfig string   sets kubeconfig path instead of $KUBECONFIG or $HOME/.kube/config
      --name string         cluster name, overrides KIND_CLUSTER_NAME, config (default kind)
      --retain              retain nodes for debugging when cluster creation fails
      --wait duration       wait for control plane node to be ready (default 0s)

Global Flags:
      --loglevel string   DEPRECATED: see -v instead
  -q, --quiet             silence all stderr output
  -v, --verbosity int32   info log verbosity
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ cat << EOF >> ~/kind-3node-config.yaml
# three node (two workers) cluster config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
EOF
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ kind-linux-amd64 create cluster --name edbpgsql --config kind-3node-config.yaml
Creating cluster "edbpgsql" ...
 ✓ Ensuring node image (kindest/node:v1.21.1) 🖼 
 ✓ Preparing nodes 📦 📦 📦 
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ 
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
 ✓ Joining worker nodes 🚜 
Set kubectl context to "kind-edbpgsql"
You can now use your cluster with:

kubectl cluster-info --context kind-edbpgsql

Have a nice day! 👋
Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ kubectl cluster-info --context kind-edbpgsql
Kubernetes control plane is running at https://127.0.0.1:43121
KubeDNS is running at https://127.0.0.1:43121/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ kubectl get nodes
NAME                     STATUS   ROLES                  AGE   VERSION
edbpgsql-control-plane   Ready    control-plane,master   14m   v1.21.1
edbpgsql-worker          Ready    <none>                 14m   v1.21.1
edbpgsql-worker2         Ready    <none>                 14m   v1.21.1
[goodgame@k8sindocker ~]$ 
[goodgame@k8sindocker ~]$ ##這是 client 工具 kubectl 的設定目錄
[goodgame@k8sindocker ~]$ ls ~/.kube/
cache  config
[goodgame@k8sindocker ~]$ tree -d ~/.kube/
/home/goodgame/.kube/
└── cache
    ├── discovery
    │   └── 127.0.0.1_43121
    │       ├── admissionregistration.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── apiextensions.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── apiregistration.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── apps
    │       │   └── v1
    │       ├── authentication.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── authorization.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── autoscaling
    │       │   ├── v1
    │       │   ├── v2beta1
    │       │   └── v2beta2
    │       ├── batch
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── certificates.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── coordination.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── discovery.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── events.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── extensions
    │       │   └── v1beta1
    │       ├── flowcontrol.apiserver.k8s.io
    │       │   └── v1beta1
    │       ├── networking.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── node.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── policy
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── postgresql.k8s.enterprisedb.io
    │       │   ├── v1
    │       │   └── v1alpha1
    │       ├── rbac.authorization.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── scheduling.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       ├── storage.k8s.io
    │       │   ├── v1
    │       │   └── v1beta1
    │       └── v1
    └── http

66 directories
[goodgame@k8sindocker ~]$ 

進到 container 裡面喵一下:這三個 docker container 被我們當作主機,運行 K8s 三節點叢集
[goodgame@k8sindocker ~]$ docker container exec -it edbpgsql-control-plane bash
root@edbpgsql-control-plane:/# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.2  18664  9656 ?        Ss   09:46   0:00 /sbin/init
root         182  0.0  0.1  23688  6860 ?        S<s  09:47   0:00 /lib/systemd/systemd-journa
root         203  0.5  1.3 1904332 51240 ?       Ssl  09:47   0:53 /usr/local/bin/containerd
root         341  0.0  0.4 712928 17148 ?        Sl   09:47   0:02 /usr/local/bin/containerd-s
root         342  0.0  0.4 712928 16816 ?        Sl   09:47   0:02 /usr/local/bin/containerd-s
root         371  0.0  0.4 713184 16832 ?        Sl   09:47   0:02 /usr/local/bin/containerd-s
root         376  0.0  0.4 713184 16056 ?        Sl   09:47   0:02 /usr/local/bin/containerd-s
65535        429  0.0  0.0    972     4 ?        Ss   09:47   0:00 /pause
65535        435  0.0  0.0    972     4 ?        Ss   09:47   0:00 /pause
65535        438  0.0  0.0    972     4 ?        Ss   09:47   0:00 /pause
65535        444  0.0  0.0    972     4 ?        Ss   09:47   0:00 /pause
root         559  5.7 10.5 1240896 404604 ?      Ssl  09:47  10:09 kube-apiserver --advertise-
root         634  1.6  1.9 10681088 75380 ?      Ssl  09:47   2:57 etcd --advertise-client-url
root         674  3.1  2.6 1857896 99728 ?       Ssl  09:48   5:30 /usr/bin/kubelet --bootstra
root         783  0.0  0.4 713184 16836 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        803  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         815  0.0  0.4 713184 16520 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        842  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         892  0.0  0.7 747628 28224 ?        Ssl  09:48   0:02 /usr/local/bin/kube-proxy -
root        1037  0.0  0.7 732352 28072 ?        Ssl  09:48   0:03 /bin/kindnetd
root        1238  0.0  0.4 712928 16536 ?        Sl   09:49   0:02 /usr/local/bin/containerd-s
65535       1258  0.0  0.0    972     4 ?        Ss   09:49   0:00 /pause
root        1280  0.0  0.4 712928 17692 ?        Sl   09:49   0:02 /usr/local/bin/containerd-s
65535       1300  0.0  0.0    972     4 ?        Ss   09:49   0:00 /pause
root        1347  0.0  0.4 713184 16996 ?        Sl   09:49   0:02 /usr/local/bin/containerd-s
65535       1366  0.0  0.0    972     4 ?        Ss   09:49   0:00 /pause
root        1502  0.1  1.1 746520 43868 ?        Ssl  09:49   0:20 /coredns -conf /etc/coredns
root        1525  0.2  1.1 746264 43720 ?        Ssl  09:49   0:21 /coredns -conf /etc/coredns
root       11135  0.2  1.3 752024 50800 ?        Ssl  10:31   0:23 kube-scheduler --authentica
root       11150  1.4  2.7 820576 103804 ?       Ssl  10:31   1:56 kube-controller-manager --a
root       11830  0.1  0.7 138472 29296 ?        Ssl  10:33   0:08 local-path-provisioner --de
root       45587  0.1  0.0   4472  3732 pts/1    Ss   12:43   0:00 bash
root       45640  0.0  0.0   6848  3024 pts/1    R+   12:43   0:00 ps aux
root@edbpgsql-control-plane:/# 
root@edbpgsql-control-plane:/# kubectl get nodes
NAME                     STATUS   ROLES                  AGE    VERSION
edbpgsql-control-plane   Ready    control-plane,master   176m   v1.21.1
edbpgsql-worker          Ready    <none>                 175m   v1.21.1
edbpgsql-worker2         Ready    <none>                 175m   v1.21.1
root@edbpgsql-control-plane:/# 
[goodgame@k8sindocker ~]$ docker container exec -it edbpgsql-worker bash
root@edbpgsql-worker:/# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.2  18472  9556 ?        Ss   09:46   0:00 /sbin/init
root         185  0.0  0.2  25620  8724 ?        S<s  09:47   0:00 /lib/systemd/systemd-journa
root         197  0.4  1.3 1856884 52316 ?       Ssl  09:47   0:53 /usr/local/bin/containerd
root         239  1.9  2.3 1857384 91152 ?       Ssl  09:48   3:28 /usr/bin/kubelet --bootstra
root         327  0.0  0.4 713184 16768 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        353  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         354  0.0  0.4 712928 16544 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        380  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         459  0.0  0.4 732352 18904 ?        Ssl  09:49   0:03 /bin/kindnetd
root         485  0.0  0.9 747628 36296 ?        Ssl  09:49   0:02 /usr/local/bin/kube-proxy -
root        1909  0.0  0.4 713184 17168 ?        Sl   10:10   0:02 /usr/local/bin/containerd-s
1001        1929  0.0  0.0    972     4 ?        Ss   10:10   0:00 /pause
1001        4776  0.3  1.5 745452 59304 ?        Ssl  10:33   0:25 /manager controller --enabl
root        4879  0.0  0.4 713440 17204 ?        Sl   10:33   0:01 /usr/local/bin/containerd-s
26          4899  0.0  0.0    972     4 ?        Ss   10:33   0:00 /pause
26          5035  0.0  1.1 744684 45256 ?        Ssl  10:34   0:02 /controller/manager instanc
26          5053  0.0  0.6 285848 26144 ?        S    10:34   0:01 postgres -D /var/lib/postgr
26          5058  0.0  0.1 136596  4760 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5059  0.0  0.1 286008  7200 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5070  0.0  0.1 285848  5992 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5071  0.0  0.1 285848  6068 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5073  0.0  0.1 138720  4832 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5078  0.0  0.3 295224 12408 ?        Ss   10:34   0:06 postgres: cluster-example: 
root        5691  0.0  0.2 713184 10316 ?        Sl   10:34   0:01 /usr/local/bin/containerd-s
26          5709  0.0  0.0    972     4 ?        Ss   10:34   0:00 /pause
26          5889  0.0  0.9 744940 37172 ?        Ssl  10:34   0:02 /controller/manager instanc
26          5944  0.0  0.6 285848 26332 ?        S    10:34   0:01 postgres -D /var/lib/postgr
26          5949  0.0  0.1 136596  4656 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5950  0.0  0.1 286008  7108 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5967  0.0  0.1 285848  5896 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5968  0.0  0.1 285848  6020 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5970  0.0  0.1 138720  4764 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          5980  0.0  0.3 295224 12304 ?        Ss   10:34   0:06 postgres: cluster-example: 
root       28680  0.3  0.0   4476  3532 pts/1    Ss   12:45   0:00 bash
root       28692  0.0  0.0   6848  3152 pts/1    R+   12:45   0:00 ps aux
root@edbpgsql-worker:/# 
[goodgame@k8sindocker ~]$ docker container exec -it edbpgsql-worker2 bash
root@edbpgsql-worker2:/# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.2  18472 10988 ?        Ss   09:46   0:00 /sbin/init
root         184  0.0  0.1  23688  6724 ?        S<s  09:47   0:00 /lib/systemd/systemd-journa
root         196  0.4  1.2 1872252 49172 ?       Ssl  09:47   0:52 /usr/local/bin/containerd
root         239  1.5  2.2 1857128 87900 ?       Ssl  09:48   2:48 /usr/bin/kubelet --bootstra
root         319  0.0  0.4 713184 16652 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        338  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         358  0.0  0.4 713184 17916 ?        Sl   09:48   0:02 /usr/local/bin/containerd-s
65535        380  0.0  0.0    972     4 ?        Ss   09:48   0:00 /pause
root         442  0.0  0.7 747372 28040 ?        Ssl  09:49   0:02 /usr/local/bin/kube-proxy -
root         495  0.0  0.6 732352 26504 ?        Ssl  09:49   0:03 /bin/kindnetd
root        3894  0.0  0.4 712928 16496 ?        Sl   10:32   0:02 /usr/local/bin/containerd-s
26          3912  0.0  0.0    972     4 ?        Ss   10:32   0:00 /pause
26          4009  0.0  1.1 744940 43904 ?        Ssl  10:32   0:03 /controller/manager instanc
26          4064  0.0  0.6 285848 25940 ?        S    10:32   0:01 postgres -D /var/lib/postgr
26          4070  0.0  0.1 136596  5136 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4072  0.0  0.3 285960 12524 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4073  0.0  0.1 285980  6164 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4074  0.0  0.2 285848 10292 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4075  0.0  0.2 286532  8980 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4076  0.0  0.1 138720  6012 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4077  0.0  0.1 138856  5176 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4078  0.0  0.1 286412  7016 ?        Ss   10:32   0:00 postgres: cluster-example: 
26          4554  0.0  0.3 287040 12900 ?        Ss   10:34   0:00 postgres: cluster-example: 
26          4798  0.0  0.3 287120 12892 ?        Ss   10:34   0:00 postgres: cluster-example: 
root       18416  0.3  0.0   4476  3556 pts/1    Ss   12:49   0:00 bash
root       18434  0.0  0.0   6848  3220 pts/1    R+   12:49   0:00 ps aux
root@edbpgsql-worker2:/# 

看一下這個環境的記憶體用量
[goodgame@k8sindocker ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:          3.6Gi       1.2Gi       700Mi        33Mi       1.7Gi       2.2Gi
Swap:            0B          0B          0B
[goodgame@k8sindocker ~]$ 

不過啟停就比較困擾惹~KIND 在這點就不是很 KIND。。
除惹軟體面的實作尚未完成,KIND 的維護者同時希望不要濫用 KIND~
因此~每次在 KIND 上的測試都是重頭開始~
於是,這邊紀錄砍掉環境的方式
[goodgame@k8sindocker ~]$ kind-linux-amd64 delete cluster --name edbpgsql
Deleting cluster "edbpgsql" ...
[goodgame@k8sindocker ~]$ 


這邊準備這篇筆記主要的目的是要作 EDB 提供的 K8s Operator — Cloud Native PostgreSQL — 的演練。因此關於如何從這個迷你叢集練習 K8s 的各種東西。。留待以後分解~



參考資料
Deploy PostgreSQL on Kubernetes Easily: Scalable and High Available Postgres Cluster on K8 Pods
Cloud Native PostgreSQL for Application Developers | The EDB Blog
Kubernetes in Docker (kind). kind 是 Kubernetes 下的一個子專案,全稱是… | by Ching Yi, Chan | InfuseAI | Medium
Goodbye minikube. I've been using minikube as my local… | by Nicolas Fränkel | Medium
使用WSL 2 與Docker Desktop 架設Kubernetes 多節點叢集環境(KinD) | The Will Will Web
Day 6 - K3D與KIND 的部署示範 - iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天
Tutorial: Spin up Your Kubernetes-in-Docker Cluster and They Will Come - Conjur
Kind cluster - The Kubebuilder Book
google cloud platform - How to stop a kubernetes cluster? - Stack Overflow
kind cluster stop and start · Issue #831 · kubernetes-sigs/kind
New command: kube stop cluster and kube start cluster · Issue #1867 · kubernetes-sigs/kind

[Update 2022/06] 用 podman 跑 KinD:這樣就變成 KinP 惹
使用podman和kind建立k8s測試環境 – Le murmure de Julian
Local Kubernetes setup with KinD on Podman - Daniel's Tech Blog
Create Kubernetes clusters with Kind, rootless Docker and rootless Podman – mohitgoyal.co
Kind with Podman on Ubuntu 20.04.LTS | LinkedIn
kind – Rootless

沒有留言:

張貼留言