1. 程式人生 > 其它 >k8s Service

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: {}