diff --git a/k8s/README.md b/k8s/README.md new file mode 100644 index 0000000..121a8f2 --- /dev/null +++ b/k8s/README.md @@ -0,0 +1,43 @@ +# violin-cv K8s 部署 + +## 一键部署 + +```bash +kubectl apply -f namespace.yaml +kubectl apply -f deployment.yaml +kubectl apply -f service.yaml +kubectl apply -f ingress.yaml +``` + +## 验证 + +```bash +# 看 pod 启动 +kubectl get pods -n drone -l app=violin-cv + +# 看 service / ingress +kubectl get svc,ing -n drone -l app=violin-cv + +# 测访问 +curl -I http://cv.violin-work.online/ +``` + +## 文件说明 + +| 文件 | 作用 | +|------|------| +| `namespace.yaml` | K8s namespace(**不会真正创建**,因为 drone namespace 已存在;保留是声明依赖) | +| `deployment.yaml` | 1 个 nginx 容器跑 HTML,replicas=1,资源极省 | +| `service.yaml` | ClusterIP,端口 80 | +| `ingress.yaml` | `cv.violin-work.online` → service:80(TLS 暂时不配,用 cert-manager 后再说) | + +## 镜像 + +由 `.drone.yml` 自动 push 到 `ccr.ccs.tencentyun.com/violin/violin-cv:latest` + +## 域名 + +`cv.violin-work.online` 需要: +1. 你的 DNS 把这个域名解析到 K8s ingress 公网 IP +2. 集群已装 nginx-ingress-controller +3. (可选)cert-manager 给 `cv.violin-work.online` 申请证书 diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml new file mode 100644 index 0000000..0e73c3c --- /dev/null +++ b/k8s/deployment.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: violin-cv + namespace: violin + labels: + app: violin-cv +spec: + replicas: 1 + selector: + matchLabels: + app: violin-cv + template: + metadata: + labels: + app: violin-cv + spec: + containers: + - name: cv + image: ccr.ccs.tencentyun.com/violin/violin-cv:latest + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 200m + memory: 128Mi diff --git a/k8s/ingress.yaml b/k8s/ingress.yaml new file mode 100644 index 0000000..3fb5edc --- /dev/null +++ b/k8s/ingress.yaml @@ -0,0 +1,26 @@ +kind: Ingress +apiVersion: networking.k8s.io/v1 +metadata: + name: violin-ingress + namespace: violin + creationTimestamp: "2026-06-29T15:36:21Z" + annotations: + kubesphere.io/creator: akadmin + traefik.ingress.kubernetes.io/router.entrypoints: websecure +spec: + ingressClassName: traefik + tls: + - hosts: + - cv.violin-home.cn + secretName: violin-tls + rules: + - host: cv.violin-home.cn + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: violin-cv + port: + number: 80 diff --git a/k8s/service.yaml b/k8s/service.yaml new file mode 100644 index 0000000..5191f4d --- /dev/null +++ b/k8s/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: violin-cv + namespace: violin +spec: + type: ClusterIP + selector: + app: violin-cv + ports: + - name: http + port: 80 + targetPort: http diff --git a/src/pages/index.html b/src/pages/index.html index f5b0d28..72321fb 100644 --- a/src/pages/index.html +++ b/src/pages/index.html @@ -1,27 +1,38 @@ +
毕业于某 985 高校计算机系,过去 6 年一直在跟分布式系统和云原生打交道。
-从 K8s 集群维护、CI/CD 流水线搭建,到微服务拆分、Service Mesh 落地,踩过的坑比文档多。但也因此对可靠性、可观测性、自动化这些东西有了执念。
-相信好的基础设施是沉默的——越少需要人操心,越说明做对了。
-毕业于某 985 高校计算机系,过去 6 年一直在跟分布式系统和云原生打交道。
+从 K8s 集群维护、CI/CD 流水线搭建,到微服务拆分、Service Mesh 落地,踩过的坑比文档多。但也因此对可靠性、可观测性、自动化这些东西有了执念。
+相信好的基础设施是沉默的——越少需要人操心,越说明做对了。
+