Skip to content

Instantly share code, notes, and snippets.

View yankay's full-sized avatar
🦆
I love nature

Kay Yan yankay

🦆
I love nature
  • DaoCloud
  • Shanghai, China
  • 09:24 (UTC +08:00)
  • LinkedIn in/yankay
View GitHub Profile
@yankay
yankay / gist:16823b3efee557ef61b93c0b54d354f7
Last active June 22, 2022 07:02
简易安装 使用 hwamei stor
安装 HwameiStor 并启用 DRBD
# 参考 https://github.com/hwameistor/documentation/blob/main/docs/02installation/01helm-chart.md
# 安装 HwameiStor
helm repo add daocloud https://release.daocloud.io/chartrepo/daocloud
helm repo update
helm upgrade hwameistor daocloud/hwameistor --install -n hwameistor --create-namespace --set k8sImageRegistry=quay.m.daocloud.io --set hwameistorImageRegistry=ghcr.m.daocloud.io
# 安装 SC https://github.com/hwameistor/local-storage/blob/main/deploy/storageclass-lvm-ha.yaml
@yankay
yankay / gist:9f2dedff708e14e24e0f5c8f333d7ea2
Last active June 21, 2022 08:42
快速创建 kubeadm 集群 (Ubuntu)
# 适用于 Ubuntu、x86 和 arm版本
export POD_CIDR="192.168.0.0/16"
export K8S_GCR_REPO=k8s-gcr.m.daocloud.io
# 配置内核
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
@yankay
yankay / gist:500b4b9b39842f6ade30f55cf469ecdd
Last active June 29, 2022 14:29
快速安装 longhorn
# https://longhorn.io/docs/1.3.0/deploy/install/#installation-requirements
cd /tmp
wget http://ghproxy.com/https://raw.githubusercontent.com/longhorn/longhorn/v1.3.0/scripts/environment_check.sh
cat environment_check.sh| sed 's/image: alpine/image: docker.m.daocloud.io\/alpine/g' > e.sh
bash e.sh
https://longhorn.io/docs/1.3.0/deploy/install/install-with-kubectl/
@yankay
yankay / gist:7dbdf5f51c8b2009f82156ab7737868c
Last active July 26, 2023 09:02
快速 安装 Local Path Provisioner
cd /tmp
wget "http://ghproxy.com/https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml"
cat local-path-storage.yaml| sed 's/image: rancher/image: docker.m.daocloud.io\/rancher/g' | sed 's/image: busybox/image: docker.m.daocloud.io\/busybox/g' > l.yaml
kubectl apply -f l.yaml
kubectl annotate sc local-path storageclass.kubernetes.io/is-default-class=true
@yankay
yankay / gist:c765102a8c36f5b2fb6c13efb108254a
Last active August 26, 2022 08:13
快速运行 cilium-test
# 参考 https://docs.cilium.io/en/v1.9/gettingstarted/k8s-install-connectivity-test/
kubectl create ns cilium-test
wget http://ghproxy.com/https://raw.githubusercontent.com/cilium/cilium/v1.9/examples/kubernetes/connectivity-check/connectivity-check.yaml
cat connectivity-check.yaml| sed 's/image: docker.io\/cilium/image: quay.m.daocloud.io\/cilium/g' | sed 's/image: docker.io/image: docker.m.daocloud.io/g' > c.yaml
kubectl apply -n cilium-test -f c.yaml
kubectl get pods -n cilium-test
helm repo add node-feature-discovery https://kubernetes-sigs.github.io/node-feature-discovery/charts
helm install node-feature-discovery -n node-feature-discovery node-feature-discovery/node-feature-discovery --set image.repository=gcr.m.daocloud.io/k8s-staging-nfd/node-feature-discovery --create-namespace
@yankay
yankay / gist:c65dece23b044c97bdeb12295c8e9ed7
Last active January 18, 2023 08:16
快速安装 metrics-server
helm repo add addon https://release.daocloud.io/chartrepo/addon
helm repo update
helm upgrade --install metrics-server -n kube-system addon/metrics-server --set image.repository=k8s.m.daocloud.io/metrics-server/metrics-server --set defaultArgs="{--kubelet-insecure-tls,--cert-dir=/tmp,--kubelet-preferred-address-types=InternalIP\,ExternalIP\,Hostname}" --create-namespace
kubectl get pods -n kube-system |grep metrics
@yankay
yankay / gist:dee8f655837f7aa8a45d57bbc851757b
Created May 24, 2022 07:49
快速运行 CIS-benchmark
wget https://ghproxy.com/github.com/aquasecurity/kube-bench/blob/main/job.yaml
cat job.yaml | sed 's/image: aquasec/image: docker.m.daocloud.io\/aquasec/g' > jobm.yaml
kubectl apply -f jobm.yaml
kubectl get pods
kubectl logs kube-bench-j76s9
# 前提条件,LB 和 PV 能力
helm repo add community https://release.daocloud.io/chartrepo/community
helm install wp -n wp community/wordpress --set global.imageRegistry=docker.m.daocloud.io --create-namespace
kubectl get pods -n wp --watch
kubectl get svc --namespace wp -w wp-wordpress
@yankay
yankay / gist:7c93e468dcada171b11c143054fb9954
Created May 16, 2022 07:00
在 kube-spray 环境下,配置时间同步
cd roles
git clone git@github.com:geerlingguy/ansible-role-ntp.git
write a ntp.yml file
```
---
- name: Check ansible version
import_playbook: ansible_version.yml
- hosts: k8s_cluster