zoukankan      html  css  js  c++  java
  • kubernetes 简单的例子

    1.nginx svc deployment

    [root@k8s k8s4nginx]# cat deploynginx.yaml
    #################################
    apiVersion: v1
    kind: Service
    metadata:
      name: nginx0920
      labels:
        app: nginx0920
    spec:
      ports:
      - port: 80
        targetPort: 80
    #  clusterIP: None
      selector:
        apps: myweb
      type: NodePort
    
    [root@k8s k8s4nginx]# cat myweb.yaml
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
        name: nginx-deployment-file
    spec:
        replicas: 1
        template:
            metadata:
                labels:
                    apps: myweb
            spec:
                containers:
                -   name: nginx
                    image: nginx:latest
                    ports:
                    - containerPort: 80

     ------------------------------------------------------------------------------

    1.简单的例子

    [root@k8s servicesidecar]# cat service.yaml
    apiVersion: v1
    kind: Service
    metadata:
      name: tomcat03
      labels:
        app: tomcat03
    spec:
      ports:
      - port: 80
        targetPort: 8080
        nodePort: 30179
      type: NodePort
      selector:
            apps: tomcat03

    2.deployment

    [root@k8s servicesidecar]# cat myweb.yaml
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
        name: tomcat03
    spec:
        replicas: 1
        template:
            metadata:
                labels:
                    apps: tomcat03
            spec:
              containers:
              - name: tomcat01
                image: k8s.gcr.io/tomcat:centos714
                ports:
                    - containerPort: 8080
                volumeMounts:
                - name: varlog
                  mountPath: /docker_home/local/tomcat8/logs
              - name: logstash01
                image: k8s.gcr.io/eslogstash:7.5.1
                volumeMounts:
                - name: varlog
                  mountPath: /tmp
                - name: conffile
                  mountPath: /usr/share/logstash/pipeline/
                - name: yamlfile
                  mountPath: /usr/share/logstash/config/
              volumes:
              - name: varlog
                hostPath:
                  path: /tmp/tomcatlog
              - name: conffile
                hostPath:
                  path: /usr/share/logstash/pipeline/
              - name: yamlfile
                hostPath:
                  path: /usr/share/logstash/config/
  • 相关阅读:
    数学系列:数学在计算机图形学中的应用
    数学系列:数学体系概览
    Math: Fibonacci
    算法系列:电磁频谱划分
    计算机系列:CUDA 深入研究
    算法系列:寻找最大的 K 个数
    算法系列:000
    算法系列:三元组和
    算法系列:单链表逆序
    堆栈区别
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/11557610.html
Copyright © 2011-2022 走看看