随笔 - 366  文章 - 0  评论 - 101  阅读 - 30万

k8s Service

[root@k8s-master12 ~]# cat nginx-svc.yaml
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: nginx             #deploy名
name: nginx-svc   #svc名
spec:
ports:
- port: 8123         #svc端口
protocol: TCP
targetPort: 80     #pod端口
selector:
app: nginx        #deploy名
status:
loadBalancer: {}

 

 

[root@k8s-master12 ~]# cat /tmp/kubectl-edit-fw5b2.yaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{},"name":"ingress-ng-zzx","namespace":"default"},"spec":{"rules":[{"host":"www.zzx3.com","http":{"paths":[{"backend":{"serviceName":"nginx","servicePort":8123},"path":"/zzx/"}]}}]}}
creationTimestamp: "2022-04-10T04:46:13Z"
generation: 1
name: ingress-ng-zzx
namespace: default
resourceVersion: "299659"
selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/ingress-ng-zzx
uid: 34707960-7433-47ad-9797-470f262c2ba7
spec:
rules:
- host: www.zzx3.com
http:
paths:
- backend:
serviceName: nginx
servicePort: 8123
path: /zzx/
status:
loadBalancer: {}

posted on   寒星12345678999  阅读(44)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 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 杂
< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

点击右上角即可分享
微信分享提示