zoukankan      html  css  js  c++  java
  • 给服务添加路由--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

  • 相关阅读:
    pormise的基本用法
    let 与 var 的区别
    字符串
    数组
    Redis 低级数据结构:一、介绍
    Curator使用:(七)分布式Barrier
    Curator使用:(六)分布式计数器
    Curator使用:(五)分布式锁
    Curator使用:(四)Master选举
    Curator使用:(三)事件监听
  • 原文地址:https://www.cnblogs.com/justart/p/11950150.html
Copyright © 2011-2022 走看看