当前位置:   article > 正文

gitlab-runner k8s cicd小demo_gitlab-runner测试demo

gitlab-runner测试demo
  1. 安装helm3
    wget http://xxxx
    mv helm /usr/local/bin
  2. 安装gitlab-runner到k8s
    helm repo add gitlab https://charts.gitlab.io
    编辑values.yaml
    imagePullPolicy: IfNotPresent
    gitlabUrl: "http://192.168.222.130:9980"
    runnerRegistrationToken: "131yjJMtno82us1B3C5t"
    concurrent: 10
    checkInterval: 30
    logLevel: info
    
    rbac:
      create: true
    
    metrics:
      enabled: false
    
    runners:
      config: |
        [[runners]]
          clone_url = "http://192.168.222.130:9980"
          [runners.kubernetes]
            namespace = "{{.Release.Namespace}}"
            image = "ubuntu:20.04"
            [[runners.kubernetes.volumes.host_path]]
                name = "docker"
                mount_path = "/var/run/docker.sock"
                host_path = "/var/run/docker.sock"
      privileged: "true"
      name: kubernetes-runner
      tags: "kubernetes,runner"
    
    securityContext:
      runAsUser: 100
      fsGroup: 65533
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    创建命名空间
    kubectl create ns kubeops
    安装
    helm install --namespace kube-ops gitlab-ops-runner -f values.yaml gitlab/gitlab-runner
  3. 编写.gitlab-ci.yml测试
    image: ubuntu
    
    stages:
      - build
    
    build:
      stage: build
      tags:
        - kubernetes
      script:
        - echo "123"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/750311
推荐阅读
相关标签
  

闽ICP备14008679号