feat(README): 文档更新
这个提交包含在:
+1
-20
@@ -1,20 +1 @@
|
|||||||
# postgresql-ha
|
### apps
|
||||||
helm instll postgresql-ha \
|
|
||||||
--set global.postgresql.username=rohow \
|
|
||||||
--set global.postgresql.password=XXX \
|
|
||||||
--set postgresql.postgresPassword=XXX \
|
|
||||||
--set namespaceOverride=infra-data \
|
|
||||||
oci://registry-1.docker.io/bitnamicharts/postgresql-ha --output-dir .
|
|
||||||
|
|
||||||
# redis
|
|
||||||
helm instll redis \
|
|
||||||
--set replica.replicaCount=0 \
|
|
||||||
--set global.redis.password=XXX \
|
|
||||||
--set namespaceOverride=infra-data \
|
|
||||||
oci://registry-1.docker.io/bitnamicharts/redis --output-dir .
|
|
||||||
|
|
||||||
# gitea
|
|
||||||
helm instll gitea \
|
|
||||||
--set redis-cluster.enabled=false \
|
|
||||||
--set postgresql-ha.enabled=false \
|
|
||||||
oci://registry-1.docker.io/giteacharts/gitea --output-dir .
|
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
apiVersion: helm.cattle.io/v1
|
||||||
|
kind: HelmChart
|
||||||
|
metadata:
|
||||||
|
name: crowdsec
|
||||||
|
namespace: infra-monitor
|
||||||
|
spec:
|
||||||
|
repo: https://crowdsecurity.github.io/helm-charts
|
||||||
|
chart: crowdsec
|
||||||
|
targetNamespace: infra-monitor
|
||||||
|
valuesContent: |-
|
||||||
|
container_runtime: containerd
|
||||||
|
image:
|
||||||
|
tag: v1.6.1
|
||||||
|
config:
|
||||||
|
config.yaml.local: |
|
||||||
|
db_config:
|
||||||
|
type: postgresql
|
||||||
|
user: rohow
|
||||||
|
password: L#GRtTR2QuL@20pm6+c~
|
||||||
|
db_name: crowdsec
|
||||||
|
host: postgresql-ha-pgpool.infra-data
|
||||||
|
port: 5432
|
||||||
|
|
||||||
@@ -44,6 +44,8 @@ spec:
|
|||||||
i18n:
|
i18n:
|
||||||
LANGS: zh-CN,en-US
|
LANGS: zh-CN,en-US
|
||||||
NAMES: 简体中文,English
|
NAMES: 简体中文,English
|
||||||
|
log:
|
||||||
|
LEVEL: Info
|
||||||
extraVolumes:
|
extraVolumes:
|
||||||
- name: gitea-custom-templates-volume
|
- name: gitea-custom-templates-volume
|
||||||
configMap:
|
configMap:
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ metadata:
|
|||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Namespace
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: infra-net
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
metadata:
|
metadata:
|
||||||
name: infra-data
|
name: infra-data
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -7,14 +7,13 @@ spec:
|
|||||||
chart: oci://registry-1.docker.io/bitnamicharts/postgresql-ha
|
chart: oci://registry-1.docker.io/bitnamicharts/postgresql-ha
|
||||||
targetNamespace: infra-data
|
targetNamespace: infra-data
|
||||||
valuesContent: |-
|
valuesContent: |-
|
||||||
global:
|
|
||||||
postgresql:
|
|
||||||
username: rohow
|
|
||||||
password: L#GRtTR2QuL@20pm6+c~
|
|
||||||
postgresql:
|
postgresql:
|
||||||
image:
|
image:
|
||||||
debug: false
|
debug: false
|
||||||
|
username: rohow
|
||||||
|
password: L#GRtTR2QuL@20pm6+c~
|
||||||
postgresPassword: L#GRtTR2QuL@20pm6+c~
|
postgresPassword: L#GRtTR2QuL@20pm6+c~
|
||||||
|
repmgrPassword: yAn0l2eiLw
|
||||||
nodeAffinityPreset:
|
nodeAffinityPreset:
|
||||||
type: "hard"
|
type: "hard"
|
||||||
key: "topology.kubernetes.io/region"
|
key: "topology.kubernetes.io/region"
|
||||||
@@ -27,6 +26,7 @@ spec:
|
|||||||
pgpool:
|
pgpool:
|
||||||
image:
|
image:
|
||||||
debug: false
|
debug: false
|
||||||
|
adminPassword: wc8FVC55JX
|
||||||
nodeAffinityPreset:
|
nodeAffinityPreset:
|
||||||
type: "hard"
|
type: "hard"
|
||||||
key: "topology.kubernetes.io/region"
|
key: "topology.kubernetes.io/region"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ apiVersion: cert-manager.io/v1
|
|||||||
kind: Certificate
|
kind: Certificate
|
||||||
metadata:
|
metadata:
|
||||||
name: dev-cm-crt
|
name: dev-cm-crt
|
||||||
namespace: kube-system
|
namespace: infra-net
|
||||||
spec:
|
spec:
|
||||||
secretName: dev-cm-crt
|
secretName: dev-cm-crt
|
||||||
issuerRef:
|
issuerRef:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ apiVersion: cert-manager.io/v1
|
|||||||
kind: Certificate
|
kind: Certificate
|
||||||
metadata:
|
metadata:
|
||||||
name: fillcode-com-crt
|
name: fillcode-com-crt
|
||||||
namespace: kube-system
|
namespace: infra-net
|
||||||
spec:
|
spec:
|
||||||
secretName: fillcode-com-crt
|
secretName: fillcode-com-crt
|
||||||
issuerRef:
|
issuerRef:
|
||||||
|
|||||||
+5
-1
@@ -1,8 +1,12 @@
|
|||||||
### 调试
|
### 调试
|
||||||
|
`
|
||||||
kubectl run -i --tty --rm --restart=Never \
|
kubectl run -i --tty --rm --restart=Never \
|
||||||
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": {"kubernetes.io/hostname": "tcc"}}}' \
|
--overrides='{"apiVersion": "v1", "spec": {"nodeSelector": {"kubernetes.io/hostname": "tcc"}}}' \
|
||||||
--image=busybox:1.28 \
|
--image=busybox:1.28 \
|
||||||
debug -- sh
|
debug -- sh
|
||||||
|
`
|
||||||
|
|
||||||
### path core中服务的节点亲和性 使他们只运行在master节点上
|
### path core中服务的节点亲和性 使他们只运行在master节点上
|
||||||
kubectl patch -n kube-system deployment coredns --patch-file=patch-affinity.yaml
|
`
|
||||||
|
kubectl patch -n kube-system deployment coredns --patch-file=patch-affinity.yaml
|
||||||
|
`
|
||||||
@@ -2,13 +2,12 @@ apiVersion: helm.cattle.io/v1
|
|||||||
kind: HelmChart
|
kind: HelmChart
|
||||||
metadata:
|
metadata:
|
||||||
name: ingress-nginx
|
name: ingress-nginx
|
||||||
namespace: kube-system
|
namespace: infra-net
|
||||||
spec:
|
spec:
|
||||||
chart: ingress-nginx
|
|
||||||
repo: https://kubernetes.github.io/ingress-nginx
|
repo: https://kubernetes.github.io/ingress-nginx
|
||||||
targetNamespace: kube-system
|
chart: ingress-nginx
|
||||||
version: 4.10.0
|
version: 4.10.0
|
||||||
set:
|
targetNamespace: infra-net
|
||||||
valuesContent: |-
|
valuesContent: |-
|
||||||
fullnameOverride: ingress-nginx
|
fullnameOverride: ingress-nginx
|
||||||
controller:
|
controller:
|
||||||
@@ -40,7 +39,7 @@ spec:
|
|||||||
publishService:
|
publishService:
|
||||||
enabled: false
|
enabled: false
|
||||||
extraArgs:
|
extraArgs:
|
||||||
default-ssl-certificate: "kube-system/dev-cm-crt"
|
default-ssl-certificate: "infra-net/dev-cm-crt"
|
||||||
config:
|
config:
|
||||||
use-forwarded-headers: "true"
|
use-forwarded-headers: "true"
|
||||||
allow-snippet-annotations: "true"
|
allow-snippet-annotations: "true"
|
||||||
|
|||||||
+24
-1
@@ -1,41 +1,64 @@
|
|||||||
### 替换hostname
|
### 替换hostname
|
||||||
|
`
|
||||||
export HOSTNAME=node
|
export HOSTNAME=node
|
||||||
hostnamectl set-hostname $HOSTNAME && reboot
|
hostnamectl set-hostname $HOSTNAME && reboot
|
||||||
vim /etc/hosts
|
vim /etc/hosts
|
||||||
|
`
|
||||||
|
|
||||||
### 安装tailscale
|
### 安装tailscale
|
||||||
|
`
|
||||||
curl -fsSL https://tailscale.com/install.sh | sh
|
curl -fsSL https://tailscale.com/install.sh | sh
|
||||||
|
`
|
||||||
|
|
||||||
### 开启tailscale的自动更新
|
### 开启tailscale的自动更新
|
||||||
|
`
|
||||||
tailscale set --auto-update
|
tailscale set --auto-update
|
||||||
|
`
|
||||||
|
|
||||||
### 开启ip转发
|
### 开启ip转发
|
||||||
|
`
|
||||||
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
|
echo 'net.ipv4.ip_forward = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
|
||||||
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
|
echo 'net.ipv6.conf.all.forwarding = 1' | tee -a /etc/sysctl.d/99-tailscale.conf
|
||||||
sysctl -p /etc/sysctl.d/99-tailscale.conf
|
sysctl -p /etc/sysctl.d/99-tailscale.conf
|
||||||
|
`
|
||||||
|
|
||||||
### 新建目录 将不同节点类型的config写入
|
### 新建目录 将不同节点类型的config写入
|
||||||
|
`
|
||||||
mkdir -p /etc/rancher/k3s && vim /etc/rancher/k3s/config.yaml
|
mkdir -p /etc/rancher/k3s && vim /etc/rancher/k3s/config.yaml
|
||||||
|
`
|
||||||
|
|
||||||
### 安装k3s 此处注意安装类型 是server 还是 agent
|
### 安装k3s 此处注意安装类型 是server 还是 agent
|
||||||
|
`
|
||||||
curl -sfL https://get.k3s.io | \
|
curl -sfL https://get.k3s.io | \
|
||||||
INSTALL_K3S_VERSION=v1.28.8 \
|
INSTALL_K3S_VERSION=v1.28.8 \
|
||||||
INSTALL_K3S_MIRROR=cn \
|
INSTALL_K3S_MIRROR=cn \
|
||||||
sh -s - server
|
sh -s - server
|
||||||
|
`
|
||||||
|
|
||||||
### 国内安装加速 & 镜像加速地址
|
### 国内安装加速 & 镜像加速地址
|
||||||
https://rancher-mirror.rancher.cn/k3s/k3s-install.sh
|
https://rancher-mirror.rancher.cn/k3s/k3s-install.sh
|
||||||
|
|
||||||
|
`
|
||||||
vim /etc/rancher/k3s/registries.yaml
|
vim /etc/rancher/k3s/registries.yaml
|
||||||
|
`
|
||||||
|
|
||||||
### 查看serverToken 记得在config中替换最新的token
|
### 查看serverToken 记得在config中替换最新的token
|
||||||
|
`
|
||||||
cat /var/lib/rancher/k3s/server/node-token
|
cat /var/lib/rancher/k3s/server/node-token
|
||||||
|
`
|
||||||
|
|
||||||
### 查看api server config 需要替换到.kube/config中 注意将其中的server地址替换为高可用地址
|
### 查看api server config 需要替换到.kube/config中 注意将其中的server地址替换为高可用地址
|
||||||
|
`
|
||||||
cat /etc/rancher/k3s/k3s.yaml
|
cat /etc/rancher/k3s/k3s.yaml
|
||||||
|
`
|
||||||
|
|
||||||
### 给node添加地域标签
|
### 给node添加地域标签
|
||||||
|
`
|
||||||
kubectl label nodes tca topology.kubernetes.io/region=cn-sh
|
kubectl label nodes tca topology.kubernetes.io/region=cn-sh
|
||||||
kubectl label nodes tca svccontroller.k3s.cattle.io/enablelb="true"
|
kubectl label nodes tca svccontroller.k3s.cattle.io/enablelb="true"
|
||||||
|
`
|
||||||
|
|
||||||
### 给master节点添加污点
|
### 给master节点添加污点
|
||||||
kubectl taint nodes tca node-role.kubernetes.io/master:NoSchedule
|
`
|
||||||
|
kubectl taint nodes tca node-role.kubernetes.io/master:NoSchedule
|
||||||
|
`
|
||||||
在新议题中引用
屏蔽一个用户