如何极狐GitLab Runner 使用特权身份运行(1),2024年最新我凭什么拿到了阿里、腾讯、今日头条3家大厂offer

先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7

深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年最新Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上运维知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新

如果你需要这些资料,可以添加V获取:vip1024b (备注运维)
img

正文

my-gitlab-gitlab-runner-6bf49f49db-7jn8w 1/1 Running 4 (53m ago) 22h
runner-q5jcztox-project-4-concurrent-0-ltmz9a7f 2/3 Error 0 37s
[root@anolis-7-9 ~]#

 

[root@anolis-7-9 ~]# kubectl -n gitlab-test logs -f runner-q5jcztox-project-4-concurrent-0-ltmz9a7f svc-0
Certificate request self-signature ok
subject=CN = docker:dind server
/certs/server/cert.pem: OK
Certificate request self-signature ok
subject=CN = docker:dind client
/certs/client/cert.pem: OK
ip: can’t find device ‘nf_tables’
nf_tables 74274 0
nfnetlink 14519 4 ip_set,nf_tables,nf_conntrack_netlink
modprobe: can’t change directory to ‘/lib/modules’: No such file or directory
ip: can’t find device ‘ip_tables’
ip_tables 27126 4 iptable_raw,iptable_mangle,iptable_nat,iptable_filter
modprobe: can’t change directory to ‘/lib/modules’: No such file or directory
mount: permission denied (are you root?)
Could not mount /sys/kernel/security.
AppArmor detection and --privileged mode might break.
mount: permission denied (are you root?)
[root@anolis-7-9 ~]#



### 解决办法


1. 导出 helm gitlab 配置

 

将已配置的值导出到文件中

helm -n gitlab-test get values my-gitlab > my-gitlab.yaml

2. 查看 [gitlab runner 默认配置]( )

 

此处为节选,不同版本可能会存在差异,请以 https://artifacthub.io/packages/helm/gitlab/gitlab?modal=values 中的配置为准

gitlab-runner:
runners:
config: |
[[runners]]
[runners.kubernetes]
image = “ubuntu:22.04”
{{- if .Values.global.minio.enabled }}
[runners.cache]
Type = “s3”
Path = “gitlab-runner”
Shared = true
[runners.cache.s3]
ServerAddress = {{ include “gitlab-runner.cache-tpl.s3ServerAddress” . }}
BucketName = “runner-cache”
BucketLocation = “us-east-1”
Insecure = false
{{ end }}

3. 修改配置如下

 

gitlab-runner:
runners:
config: |
[[runners]]
[runners.kubernetes]

    # pod 使用特权身份运行
    privileged = true
    
    image = "ubuntu:22.04"
    {{- if .Values.global.minio.enabled }}
    [runners.cache]
      Type = "s3"
      Path = "gitlab-runner"
      Shared = true
      [runners.cache.s3]
        ServerAddress = {{ include "gitlab-runner.cache-tpl.s3ServerAddress" . }}
        BucketName = "runner-cache"
        BucketLocation = "us-east-1"
        Insecure = false
    {{ end }}
4. 更新配置

 

GitLab Runner 使用特权身份运行

helm upgrade -n gitlab-test --install my-gitlab gitlab/gitlab --timeout 600s -f my-gitlab.yaml --set gitlab-runner.runners.privileged=true --version 7.7.0

5. 等待所有 `gitlab-runner` 旧 `pod` 删除完成,新 `pod` 正常运行时,重试流水线,即可使用 `docker in docker`

 

[root@anolis-7-9 ~]# kubectl -n gitlab-test get pod | grep runner
my-gitlab-gitlab-runner-5f6ff5994c-wdw5l 1/1 Running 0 115m
runner-yr5wzqmq-project-4-concurrent-0-idibutkf 3/3 Running 0 4s
[root@anolis-7-9 ~]#

 注意此处查看的是 **svc-0** 的日志,即:services docker 的日志, 多个 services 时按顺序排序

 

[root@anolis-7-9 ~]# kubectl -n gitlab-test logs -f runner-yr5wzqmq-project-4-concurrent-0-idibutkf svc-0
time=“2023-12-23T16:34:27.467258283Z” level=info msg=“Starting up”
time=“2023-12-23T16:34:27.469102439Z” level=warning msg=“could not change group /var/run/docker.sock to docker: group docker not found”
time=“2023-12-23T16:34:27.469335776Z” level=warning msg=“Binding to IP address without --tlsverify is insecure and gives root access on this machine to everyone who has access to your network.” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:27.469359429Z” level=warning msg=“Binding to an IP address, even on localhost, can also give access to scripts run in a browser. Be safe out there!” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:28.469505651Z” level=warning msg=“Binding to an IP address without --tlsverify is deprecated. Startup is intentionally being slowed down to show this message” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:28.469545042Z” level=warning msg=“Please consider generating tls certificates with client validation to prevent exposing unauthenticated root access to your network” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:28.469555494Z” level=warning msg=“You can override this by explicitly specifying ‘–tls=false’ or ‘–tlsverify=false’” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:28.469568946Z” level=warning msg=“Support for listening on TCP without authentication or explicit intent to run without authentication will be removed in the next release” host=“tcp://0.0.0.0:2375”
time=“2023-12-23T16:34:43.473007148Z” level=info msg=“libcontainerd: started new containerd process” pid=33
time=“2023-12-23T16:34:43.473101488Z” level=info msg=“parsed scheme: “unix”” module=grpc
time=“2023-12-23T16:34:43.473114333Z” level=info msg=“scheme “unix” not registered, fallback to default scheme” module=grpc
time=“2023-12-23T16:34:43.473147363Z” level=info msg=“ccResolverWrapper: sending update to cc: {[{unix:///var/run/docker/containerd/containerd.sock 0 }] }” module=grpc
time=“2023-12-23T16:34:43.473181211Z” level=info msg=“ClientConn switching balancer to “pick_first”” module=grpc
time=“2023-12-23T16:34:43Z” level=warning msg=“deprecated version : 1, please switch to version 2
time=“2023-12-23T16:34:43.515744080Z” level=info msg=“starting containerd” revision=212e8b6fa2f44b9c21b2798135fc6fb7c53efc16 version=v1.6.4
time=“2023-12-23T16:34:43.531630020Z” level=info msg=“loading plugin “io.containerd.content.v1.content”…” type=io.containerd.content.v1
time=“2023-12-23T16:34:43.531804565Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.aufs”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538312017Z” level=info msg=“skip loading plugin “io.containerd.snapshotter.v1.aufs”…” error=“aufs is not supported (modprobe aufs failed: exit status 1 “ip: can’t find device ‘aufs’\nmodprobe: can’t change directory to ‘/lib/modules’: No such file or directory\n”): skip plugin” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538412286Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.btrfs”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538731958Z” level=info msg=“skip loading plugin “io.containerd.snapshotter.v1.btrfs”…” error=“path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs (xfs) must be a btrfs filesystem to be used with the btrfs snapshotter: skip plugin” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538767621Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.devmapper”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538782676Z” level=warning msg=“failed to load plugin io.containerd.snapshotter.v1.devmapper” error=“devmapper not configured”
time=“2023-12-23T16:34:43.538792101Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.native”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.538972652Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.overlayfs”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.539265161Z” level=info msg=“loading plugin “io.containerd.snapshotter.v1.zfs”…” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.539441863Z” level=info msg=“skip loading plugin “io.containerd.snapshotter.v1.zfs”…” error=“path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin” type=io.containerd.snapshotter.v1
time=“2023-12-23T16:34:43.539459872Z” level=info msg=“loading plugin “io.containerd.metadata.v1.bolt”…” type=io.containerd.metadata.v1
time=“2023-12-23T16:34:43.539554275Z” level=warning msg=“could not use snapshotter devmapper in metadata plugin” error=“devmapper not configured”
time=“2023-12-23T16:34:43.539571921Z” level=info msg=“metadata content store policy set” policy=shared
time=“2023-12-23T16:34:43.541205021Z” level=info msg=“loading plugin “io.containerd.differ.v1.walking”…” type=io.containerd.differ.v1
time=“2023-12-23T16:34:43.541252637Z” level=info msg=“loading plugin “io.containerd.event.v1.exchange”…” type=io.containerd.event.v1
time=“2023-12-23T16:34:43.541272679Z” level=info msg=“loading plugin “io.containerd.gc.v1.scheduler”…” type=io.containerd.gc.v1
time=“2023-12-23T16:34:43.541407221Z” level=info msg=“loading plugin “io.containerd.service.v1.introspection-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.541450967Z” level=info msg=“loading plugin “io.containerd.service.v1.containers-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.541468124Z” level=info msg=“loading plugin “io.containerd.service.v1.content-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.541488780Z” level=info msg=“loading plugin “io.containerd.service.v1.diff-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.541510847Z” level=info msg=“loading plugin “io.containerd.service.v1.images-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.543022895Z” level=info msg=“loading plugin “io.containerd.service.v1.leases-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.543105358Z” level=info msg=“loading plugin “io.containerd.service.v1.namespaces-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.543146490Z” level=info msg=“loading plugin “io.containerd.service.v1.snapshots-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.543314215Z” level=info msg=“loading plugin “io.containerd.runtime.v1.linux”…” type=io.containerd.runtime.v1
time=“2023-12-23T16:34:43.543713683Z” level=info msg=“loading plugin “io.containerd.runtime.v2.task”…” type=io.containerd.runtime.v2
time=“2023-12-23T16:34:43.543917845Z” level=info msg=“loading plugin “io.containerd.monitor.v1.cgroups”…” type=io.containerd.monitor.v1
time=“2023-12-23T16:34:43.544701904Z” level=info msg=“loading plugin “io.containerd.service.v1.tasks-service”…” type=io.containerd.service.v1
time=“2023-12-23T16:34:43.544758132Z” level=info msg=“loading plugin “io.containerd.grpc.v1.introspection”…” type=io.containerd.grpc.v1
time=“2023-12-23T16:34:43.544778482Z” level=info msg=“loading plugin “io.containerd.internal.v1.restart”…” type=io.containerd.internal.v1
time=“2023-12-23T16:34:43.544870050Z” level=info msg=“loading plugin “io.containerd.grpc.v1.containers”…” type=io.containerd.grpc.v1
time=“2023-12-23T16:34:43.544905675Z” level=info msg=“loading plugin “io.containerd.grpc.v1.content”…” type=io.containerd.grpc.v1

最全的Linux教程,Linux从入门到精通

======================

  1. linux从入门到精通(第2版)

  2. Linux系统移植

  3. Linux驱动开发入门与实战

  4. LINUX 系统移植 第2版

  5. Linux开源网络全栈详解 从DPDK到OpenFlow

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

第一份《Linux从入门到精通》466页

====================

内容简介

====

本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。

华为18级工程师呕心沥血撰写3000页Linux学习笔记教程

本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。

需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注运维)
img

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

需要这份系统化的资料的朋友,可以添加V获取:vip1024b (备注运维)
[外链图片转存中…(img-QUhgDf8e-1713585111829)]

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 24
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值