• k8s 玩转 jenkins


    $ cat pvc.yaml 
    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: jenkins
      namespace: jenkins
    spec:
      accessModes:
        - ReadWriteOnce
      resources:
        requests:
          storage: 30Gi
      storageClassName: rbd
    
    
    $ cat   deployment.yaml 
    apiVersion: apps/v1
    kind: Deployment
    metadata:
        name: jenkins
        namespace: jenkins
    spec:
      replicas: 1
      strategy:
        type: RollingUpdate
        rollingUpdate:
          maxSurge: 1
          maxUnavailable: 0
      selector:
        matchLabels:
          app: jenkins
      template:
        metadata:
          labels:
            app: jenkins
        spec:
          dnsPolicy: ClusterFirst
          containers:
          - name: jenkins
            image: jenkins/jenkins:lts
            imagePullPolicy: IfNotPresent
            securityContext:
              runAsUser: 0
            ports:
            - containerPort: 8080
              name: web
              protocol: TCP
            - containerPort: 50000
              name: agent
              protocol: TCP
            env:
            - name: JAVA_OPTS
              value: "-Duser.timezone=Asia/Shanghai"
            volumeMounts:
              - name: jenkinshome
                mountPath: /var/jenkins_home
          volumes:
          - name: jenkinshome
            persistentVolumeClaim:
              claimName: jenkins
    
    
    $ cat service.yaml
    kind: Service
    apiVersion: v1
    metadata:
      name: jenkins
      namespace: jenkins
      labels:
        app: jenkins
    spec:
      ports:
      - port: 8080
        targetPort: 8080
        name: web
      selector:
        app: jenkins
    
    
    $ cat ingress.yaml
    apiVersion: extensions/v1beta1
    kind: Ingress
    metadata:
      name: jenkins
      namespace: jenkins
      annotations:
        kubernetes.io/ingress.class: "nginx"
    spec:
      rules:
      - host: xxjenkins.tagtic.cn
        http:
          paths:
          - path: '/'
            backend:
              serviceName: jenkins
              servicePort: 8080
      tls:
      - hosts:
        - xxjenkins.tagtic.cn
        secretName:  all-tagtic.cn
    
    $cd agent/ 
    $ cat service.yaml 
    apiVersion: v1
    kind: Service
    metadata:
      labels:
        app: jenkins
      name: jenkins-agent
      namespace: jenkins
    spec:
      ports:
      - name: agent
        port: 50000
        protocol: TCP
        targetPort: 50000
      selector:
        app: jenkins
      sessionAffinity: None
      type: ClusterIP
    

    配置 jenkins

     

     

     

     

     

     

     

     

     

  • 相关阅读:
    http请求需要了解的一些信息
    mac修改终端配色方案
    SpringBoot之使用Redisson实现分布式锁
    https://coding.m.imooc.com/classindex.html?cid=402
    构建微电影
    一个开源的后台管理项目
    mysql
    redis安装
    maven 安装
    Django2.1集成xadmin管理后台所遇到的错误集锦,解决填坑
  • 原文地址:https://www.cnblogs.com/lixinliang/p/12217794.html
Copyright © 2020-2023  润新知