Kubernetes Ingress k8s 1.16之前版本生效(1)

Kubernetes Ingress k8s 1.16之前版本生效(1)_第1张图片
deployment-v1.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-version-v1-deployment
  labels:
    app: node-version
    version: v1
spec:
  
  replicas: 1
  selector:
    matchLabels:
      app: node-version
      version: v1
  template:
    metadata:
      labels:
        app: node-version
        version: v1
    spec:
      containers:
        - name: node-version
          image: web:v1
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 3000
              protocol: TCP
          resources:
            limits:
              memory: "200Mi"
              cpu: "200m"
            requests:
              memory: "100Mi"
              cpu: "100m"
          readinessProbe:
            httpGet:
              port: 3000
              path: /
              scheme: HTTP
            failureThreshold: 5
            successThreshold: 2
            initialDelaySeconds: 30
          livenessProbe:
            httpGet:
              port: 3000
              path: /
              scheme: HTTP
            failureThreshold: 5
            successThreshold: 1
            initialDelaySeconds: 30

service-v1.yml

apiVersion: v1
kind: Service
metadata:
  name: node-version-v1-service
spec:
  selector:
    app: node-version
    version: v1
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 3000

Ingress

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: node-version-ingress
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
spec:
  rules:
    - host: v1.jainishshah.com
      http:
        paths:
          - backend:
              serviceName: node-version-v1-service
              servicePort: 80
            path: /
    - host: v2.jainishshah.com
      http:
        paths:
          - backend:
              serviceName: node-version-v2-service
              servicePort: 80
            path: /

你可能感兴趣的:(k8s,Prometheus)