k8s yaml
ingress
1 2 3 4 5 6 7 8 9 10 11 12 13 | apiVersion: extensions/v1beta1 kind: Ingress metadata: name: nginx-test-v2-ingress #ingress名 spec: rules: - host: www.zzx2.com #域名 http: paths: - path: /zzx/ #匹配的上下文 backend: serviceName: nginx-test-v2-svc # svc的metadata下的 name,就是svc的name servicePort: 8123 |
svc selector: app: 要写deploy的metadata下的name, targetPort是deploy的pod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | apiVersion: v1 kind: Service metadata: creationTimestamp: null labels: app: nginx name: nginx-test-v2-svc spec: ports: - port: 8123 protocol: TCP targetPort: 80 selector: app: nginx-test ##deploy的spec下matchLabels和labels下的app status: loadBalancer: {} |
deploy
hostPath mountPath: /etc/localtime 被计算节点映射的pod文件 计算节点/etc/localtime替换容器/etc/localtime, 计算节点/root挂载到容器/zzx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: app: nginx-xxx name: nginx-test-v2 spec: replicas: 1 selector: matchLabels: app: nginx-test # -o wide显示的 SELECTOR , 和svc的selector一致 strategy: {} template: metadata: creationTimestamp: null labels: app: nginx-test # 和selector的matchLabels的app一致 spec: containers: - image: zzxng:v2 name: zzxng-containers-v2 resources: {} volumeMounts: - mountPath: /etc/localtime name: mylocaltime - mountPath: /zzx name: mountdata volumes: - hostPath: path: /etc/localtime type: "" name: mylocaltime - hostPath: path: /root type: Directory name: mountdata status: {} |
1 | selector |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
2015-04-10 mysql view 视图
2015-04-10 mysql 杂