This commit is contained in:
@@ -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` 申请证书
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
+686
-418
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user