k8s yaml

作者: 寺院的研究僧 | 来源:发表于2018-01-04 20:30 被阅读308次

    nginx rc/svc/ingress

    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: yangsen-nginx-rc
      namespace: default
    spec:
      replicas: 1
      selector:
        app: yangsen-nginx
      template:
        metadata:
          labels:
            app: yangsen-nginx
        spec:
          containers:
          - name: nginx
            image: russmckendrick_cluster:latest
            imagePullPolicy: IfNotPresent
            livenessProbe:
              httpGet:
                path: /
                port: 80
                scheme: HTTP
              initialDelaySeconds: 30
              periodSeconds: 5
              timeoutSeconds: 5
            resources:
              limits:
                cpu: 10m
                memory: 20Mi
              requests:
                cpu: 10m
                memory: 20Mi
            ports:
            - containerPort: 80
              protocol: TCP
            volumeMounts:
            - mountPath: /var/log/nginx
              name: yangsen-nginx-logvolume
            - mountPath: /etc/localtime
              name: localtime
              readOnly: true
          - name: filebeat
            image: docker.elastic.co/beats/filebeat:5.5
            imagePullPolicy: IfNotPresent
            env:
            - name: ES_SERVERS
              value: 10.12.0.107:5044
            - name: HOST_IP
              value: 10.12.0.142
            volumeMounts:
            - mountPath: /var/log/nginx
              name: yangsen-nginx-logvolume
          restartPolicy: Always
          volumes:
          - name: yangsen-nginx-logvolume
            emptyDir: {}
          - name: localtime
            hostPath:
              path: /etc/localtime
    
    ---
    kind: Service
    apiVersion: v1
    metadata:
      labels:
        app: yangsen-nginx
      name: yangsen-nginx-svc
      namespace: default
    spec:
      ports:
      - name: nginx
        port: 80
        targetPort: 80           #containerPort: 80
        nodePort: 30080
        protocol: TCP
      type: NodePort             #type: LoadBalancer,ClusterIP,NodePort,ExternalName
      selector:
        app: yangsen-nginx
    
    
    ---
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: yangsen-nginx-ingress
      namespace: default
    spec:
      rules:
      - host: nginx.yangsen.com
        http:
          paths:
          - path: /
            backend:
              serviceName: yangsen-nginx-svc
              servicePort: 80
    

    相关文章

      网友评论

          本文标题:k8s yaml

          本文链接:https://www.haomeiwen.com/subject/nmflnxtx.html