• 给服务添加路由--ingress


    kind: Namespace
    apiVersion: v1
    metadata:
      name: demo-webshell
      generateName: demo-webshell
      labels:
        name: demo-webshell
        purpose: Demonstration
      annotations:
        describe: Just show how to create
    status:
      phase: ''
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: webshell-ingress
      namespace: demo-webshell
    spec:
      rules:
      - host: webshell.com
        http:
          paths:
          - path: /
            backend:
              serviceName: webshell
              servicePort: 80
          - path: /ping
            backend:
              serviceName: webshell
              servicePort: 80
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: webshell
      namespace: demo-webshell
    spec:
      type: ClusterIP
      ports:
      - name: webshell
        port: 80
        targetPort: 80
        protocol: TCP
      - name: ssh
        port: 22
        targetPort: 22
        protocol: TCP
      selector:
        app: webshell
    ---
    apiVersion: v1
    kind: Service
    metadata:
      name: webshell-nodeport
      namespace: demo-webshell
    spec:
      type: NodePort
      ports:
      - name: webshell
        port: 80
        targetPort: 80
        protocol: TCP
      - name: ssh
        port: 22
        targetPort: 22
        protocol: TCP
      selector:
        app: webshell
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: webshell
      namespace: demo-webshell
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: webshell
      template:
        metadata:
          labels:
            name: webshell
            app: webshell
        spec:
          containers:
          - name: webshell
            image: lijiaocn/webshell:1.0
            resources:
              limits:
                cpu: 3
                memory: 128Mi
              requests:
                cpu: 0.1
                memory: 32Mi
            livenessProbe:
              tcpSocket:
                port: 80
              initialDelaySeconds: 5
              timeoutSeconds: 5
              periodSeconds: 10
              successThreshold: 1
              failureThreshold: 3
            imagePullPolicy: Always
            securityContext:
              privileged: false
              runAsNonRoot: false
            stdin: false
            stdinOnce: false
            tty: false
          - name: sshproxy
            image: lijiaocn/sshproxy:1.0
            env:
            - name: ROOTPASS
              value: '123456'
            resources:
              limits:
                cpu: 3
                memory: 128Mi
              requests:
                cpu: 0.1
                memory: 32Mi
            livenessProbe:
              tcpSocket:
                port: 22
              initialDelaySeconds: 5
              timeoutSeconds: 5
            imagePullPolicy: Always
            securityContext:
              privileged: false
              runAsNonRoot: false
            stdin: false
            stdinOnce: false
            tty: false
          restartPolicy: Always
          dnsPolicy: Default
          serviceAccountName: default
          hostNetwork: false
          hostPID: false
          hostIPC: false

  • 相关阅读:
    HDU
    HDU
    HDU
    2016蓝桥杯省赛C/C++A组第二题 跳蚱蜢
    2016蓝桥杯决赛C/C++A组第四题 路径之谜
    【洛谷P2397】yyy loves Maths VI (mode)【模拟】
    【洛谷P2397】yyy loves Maths VI (mode)【模拟】
    【NOIP2018】【洛谷P5017】摆渡车【DP】
    【NOIP2018】【洛谷P5017】摆渡车【DP】
    2018NOIP普及组 划水记
  • 原文地址:https://www.cnblogs.com/justart/p/11950150.html
Copyright © 2020-2023  润新知