jenkins对接K8S

创建连接K8S的凭据

查看需要使用到的命名空间
[root@k8s ~]# kubectl get ns |grep arts-system
arts-system       Active   16d
创建service accounts
[root@k8s ~]# kubectl create sa jenkins-k8s -n arts-system
serviceaccount/jenkins-k8s created
[root@k8s ~]# kubectl get sa -n arts-system |grep jenkins
jenkins-k8s   1         14s
对jenkins做cluster-admin绑定
[root@k8s ~]# kubectl create clusterrolebinding jenkins-k8s-role-binding --clusterrole cluster-admin --serviceaccount=arts-system:jenkins-k8s -n arts-system
clusterrolebinding.rbac.authorization.k8s.io/jenkins-k8s-role-binding created
[root@k8s ~]# kubectl get clusterrolebinding -n arts-system
NAME                       AGE
jenkins-k8s-role-binding   29s
system:coredns             3y264d
查看arts-system命名空间中的sa和secret
[root@k8s ~]# kubectl get sa,secret -n arts-system
NAME                         SECRETS   AGE
serviceaccount/default       1         16d
serviceaccount/jenkins-k8s   1         3m30s

NAME                             TYPE                                  DATA   AGE
secret/default-token-scbjb       kubernetes.io/service-account-token   3      16d
secret/jenkins-k8s-token-qjr6p   kubernetes.io/service-account-token   3      3m30s
提取token
[root@k8s ~]# kubectl describe secrets jenkins-k8s-token-qjr6p -n arts-system
Name:         jenkins-k8s-token-qjr6p
Namespace:    arts-system
Labels:       <none>
Annotations:  kubernetes.io/service-account.name: jenkins-k8s
              kubernetes.io/service-account.uid: e7d1633d-3419-4a95-b8e8-e4f1956989e8

Type:  kubernetes.io/service-account-token

Data
====
namespace:  11 bytes
token:      eyJhbGciOiJSUzI1NiIsImtpZCI6IlNybzBGYzNoYklYWlJlM2NsU0VWNTY2TGZlM2E3a1RUYm5ObmJxLXFZMjAifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJhcnRzLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJqZW5raW5zLWs4cy10b2tlbi1xanI2cCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50Lm5hbWUiOiJqZW5raW5zLWs4cyIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6ImU3ZDE2MzNkLTM0MTktNGE5NS1iOGU4LWU0ZjE5NTY5ODllOCIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDphcnRzLXN5c3RlbTpqZW5raW5zLWs4cyJ9.wIPNdnYKqNGdUv0bYwDgGFW4_EhR3vKcFdHsmrQFbtiWomLBQERZe9xs1adO4qJm5V40sCozWJWiv6yE9ZN8stEI_FTJcaLDeLJDqYe-2BAuGXG6sDOUsjk2vc7K4NJb2xi508xyof5xuS2mTBwMXiyO_zhefrXVq9NrQd9hrUFQOhcod_SoWu965unOA4uDqxi9Sgll4RW-yG9lN5PK18xaGEHvJHldS_vT8JhvQ1lvjxDWxZkYvXJLN9i0Yp0bHal6GNCl4tDaMmTCyvuhuhBWldB57fwNrO71hrl1rN8BKy0ngeJ4SUr3TqA0cSpDXyAdS01OnwaokiVt3APM-A
ca.crt:     1099 bytes

jenkins上创建连接K8S的凭证

请添加图片描述

jenkins连接K8S

请添加图片描述

配置连接k8s需要的kubeconfig文件

获取k8s的kubecofnig文件
[root@k8s kubernetes]# cat kubeconfig
Version: v1
kind: Config
users:
- name: controllermanager
  user:
    client-certificate: /var/lib/kubernetes/cs_client.crt
    client-key: /var/lib/kubernetes/cs_client.key
clusters:
- name: local
  cluster:
    certificate-authority: /var/lib/kubernetes/ca.crt
    server: https://192.168.73.100:6443
contexts:
- context:
    cluster: local
    user: controllermanager
  name: my-context
current-context: my-context
将kubecofig文件中的认证填写到该文件中
### 获取认证文件内容并进行base64编码
[root@k8s kubernetes]# cat /var/lib/kubernetes/cs_client.crt | base64 | tr -d '\n'
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JS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zRms5UnNNdFBjcXFjSmdPL3JGelVuMDRhRHdJREFRQUJvMUF3VGpBZEJnTlZIUTRFRmdRVU9kZFI1dlhYCk5kaWZWRmFNWjRUZ0FQY0U3L1F3SHdZRFZSMGpCQmd3Rm9BVU9kZFI1dlhYTmRpZlZGYU1aNFRnQVBjRTcvUXcKREFZRFZSMFRCQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFXTnA2Nm05QjJOZWUyaHdLbmo1awp6WDY2d0YrbkFrQlVFbEhQeDlsZDBKcVhDaDRUZ2RNcGR0ckRaNG1CUS9oUXVpaThtQjQ2TFlDM2VtVGYvRGJMCkxnSUN2eVhlLythWjY1MkVBeFNtUndpU3FOaHFGc09hcUx1UlVialpRKzNvRmt0WVlVN0pFcWs2bnlub3hUR0oKeDFBQU45cFdXdkRPT09tNHpscGdxY3Y4cnpEL1MweEZoaWFWVnR6N29KeGVsdllpTzFlclJybDB3a2Y0SnlJVwpPTlNIZ0VXaVFTRTFUNHp2WHV3MHI2MndXRUs2ZktFYXZHYWtHU3B5YWxjcFVPTE01YmE3dnZzOWRTRWVGZEhhClZUL0xXWTA1RmJBN1hzOXd4SnNMS2djeEVzM2Y3dkVaaGhQRTJjZHpPeG9ra3B6NjdqZHN6QVZCbzZWQlA5SHoKR1E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
    server: https://192.168.73.100:6443
contexts:
- context:
    cluster: local
    user: controllermanager
  name: my-context
current-context: my-context

安装 配置文件管理 插件

请添加图片描述

添加kubecofnig文件

请添加图片描述
请添加图片描述

请添加图片描述

请添加图片描述

生成一个流水

请添加图片描述

生成的流水脚本如下
configFileProvider([configFile(fileId: '1af5255e-d0db-4009-8218-12448ede43e3', targetLocation: 'arts-system.kubeconfig')]) {
    // some block
}
完善流水脚本,进行一个测试
pipeline {
    agent any

    stages {
        stage('测试部署') {
            steps {
                script{
                    configFileProvider([configFile(fileId: '1af5255e-d0db-4009-8218-12448ede43e3', targetLocation: 'arts-system.kubeconfig')]) {
                        sh '''
                        kubectl get node --kubeconfig=arts-system.kubeconfig
                        '''
                    }
                }
            }
        }
    }
}
创建一个流水然后进行测试的结果如下

请添加图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/354979.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

log4j2 配置入门介绍

配置 将日志请求插入到应用程序代码中需要进行大量的计划和工作。 观察表明&#xff0c;大约4%的代码专门用于日志记录。因此&#xff0c;即使是中等规模的应用程序也会在其代码中嵌入数千条日志记录语句。 考虑到它们的数量&#xff0c;必须管理这些日志语句&#xff0c;而…

CTF CRYPTO 密码学-7

题目名称&#xff1a;敲击 题目描述&#xff1a; 让我们回到最开始的地方 0110011001101100011000010110011101111011011000110110010100110011011001010011010100110000001100100110001100101101001101000011100001100011001110010010110100110100011001000011010100110000…

python简单socket demo

socket说明 socket本质是编程接口(API)&#xff0c;对TCP/IP的封装&#xff0c;TCP/IP也要提供可供程序员做网络开发所用的接口&#xff0c;这就是Socket编程接口。除了常见的http请求之外&#xff0c;一些敏感的数据传输常用socket套接字层直接传输数据。一个简单的domo用于熟…

构造器模式

构造器模式 意图 将一个复杂对象的构建和表示分离&#xff0c;使得相同的构建能创建不同的表示。 解释 案例&#xff1a;想象一个角色扮演游戏的特征生成器。最简单的选择是让计算机为你创建角色。如果你想手动选择特征的细节像职业、性别、头发的颜色等。特征的产生是一个循…

【golang】16、dlv 调试工具、vscode+ssh 远程调试

文章目录 Goland Debug 模式崩溃 Goland Debug 模式崩溃 有时遇到如下现象&#xff1a; Golang Run 模式正常&#xff0c;Debug 无 BreakPoint 模式正常&#xff0c;但 Debug 加 BreakPoint 就会偶现 panic&#xff0c;panic 信息如下。 panic: runtime error: index out of …

敲黑板啦!CSGO游戏搬砖项目操作注意事项

CSGO游戏搬砖项目怎么赚钱的&#xff0c;利润在哪&#xff1f; 1.两个平台之间币种不一样&#xff0c;就存在一个汇率差&#xff0c;两平台装备价格也不一样&#xff0c;汇率差-价格差利润。 CSGO游戏搬砖项目具体有哪些操作步骤&#xff1f; 1、准备一台电脑&#xff0c;配置…

操作系统(7)----调度相关知识点(万字总结~)

目录 一.调度的三个层次 1.高级调度 2.低级调度 3.中级调度 二.进程的挂起状态 三.进程调度的时机 四.进程调度方式 1.非剥夺调度方式 2.剥夺调度方式 五.进程的切换与过程 六.调度器/调度程序 1.调度程序 2.闲逛进程 七.评价调度算法的各个指标 1.CPU利用率 2…

yarn安装第三方插件包,提示报错,yarn的镜像源已经过期了,因为yarn和npm用的是淘宝的镜像源,淘宝的镜像源已经过期了,要设置最新的淘宝镜像源。

淘宝最新镜像源切换_淘宝镜像-CSDN博客 查看yarn用的什么镜像源 yarn config get registry 查看具体的信息 yarn config list 设置淘宝的最新镜像源&#xff0c;yarn和npm都要设置最新的淘宝镜像源&#xff0c;不然还是报错 npm config set registry https://registry.npmm…

Mysql-存储引擎-InnoDB

数据文件 下面这条SQL语句执行的时候指定了ENGINE InnoDB存储引擎为InnoDB: CREATE TABLE tb_album (id bigint(20) NOT NULL AUTO_INCREMENT COMMENT 编号,title varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 相册名称,image varc…

leetcode26. 删除有序数组中的重复项

题目 题目 给你一个 非严格递增排列 的数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使每个元素 只出现一次 &#xff0c;返回删除后数组的新长度。元素的 相对顺序 应该保持 一致 。然后返回 nums 中唯一元素的个数。 考虑 nums 的唯一元素的数量为 k &…

python笔记10

1、继承 继承是面向对象编程中的一个重要概念&#xff0c;它允许一个类&#xff08;子类&#xff09;继承另一个类&#xff08;父类&#xff09;的属性和方法。通过继承&#xff0c;子类可以重用父类的代码&#xff0c;并且有机会添加新的属性和方法&#xff0c;或者重写父类的…

【HTML 基础】元素和标签

文章目录 1. <p> - 段落标签2. <h1> - <h6> - 标题标签3. <a> - 超链接标签4. <img> - 图片标签5. <ul>, <ol>, <li> - 列表标签无序列表有序列表 总结 HTML&#xff08;Hypertext Markup Language&#xff09;是构建 Web 页面…

RabbitMQ快速实战

目录 什么是消息队列&#xff1f; 消息队列的优势 应用解耦 异步提速 削峰填谷 总结 主流MQ产品特点比较 Rabbitmq快速上手 创建用户admin Exchange和Queue Connection和Channel RabbitMQ中的核心概念总结 什么是消息队列&#xff1f; MQ全称Message Queue&#xf…

某大厂关于Linux系统相关面试题

一、Linux系统和Shell 1、写一个sed命令&#xff0c;修改/tmp/input.txt文件的内容&#xff0c;要求&#xff1a;(1) 删除所有空行&#xff1b;(2) 在非空行前面加一个"AAA"&#xff0c;在行尾加一个"BBB"&#xff0c;即将内容为11111的一行改为&#xff1…

linux 下scrcpy 手机投屏到电脑,QT+ffmpeg 获取视频流,处理等等

linux 下scrcpy 手机投屏到电脑,QT+ffmpeg 获取视频流,处理 1 安装 scrcpy 地址 https://github.com/Genymobile/scrcpy 转到 relese 下载 我这里下载的是linux系统 v2.3.1 版本 scrcpy-2.3.1.tar.gz 下载 scrcpy-server v2.3.1 版本 scrcpy-server-v2.3.1 解压scrcpy-2.3…

【工具推荐】磁盘分析工具 | SpaceSniffer 高效分析

文章目录 1 下载2 分析 最近发现一款很好用的工具——SpaceSniffer&#xff08;磁盘空间分析工具&#xff09; 硬盘用久了&#xff0c;里头的文件总是杂乱不堪&#xff0c;十分影响效率和心情&#xff1b; 我们往往会忘记哪些内容占用的空间比较多~所以我们如果可以高效分析哪…

Linux 网络流量相关工具

本文聚焦于网络流量的查看、端口占用查看。至于网络设备的管理和配置&#xff0c;因为太过复杂且不同发行版有较大差异&#xff0c;这里就不赘述&#xff0c;后面看情况再写。 需要注意的是&#xff0c;这里列出的每一个工具都有丰富的功能&#xff0c;流量/端口信息查看只是其…

深度学习-使用Labelimg数据标注

数据标注是计算机视觉和机器学习项目中至关重要的一步&#xff0c;而使用工具进行标注是提高效率的关键。本文介绍了LabelImg&#xff0c;一款常用的开源图像标注工具。用户可以在图像中方便而准确地标注目标区域&#xff0c;为训练机器学习模型提供高质量的标注数据。LabelImg…

软件设计师-23年上半年-下午试题

软件设计师-23年上半年-下午试题 更多软考资料 https://ruankao.blog.csdn.net/试题一、二、三、四必答&#xff0c;五、六二选一 试题一(15分) 说明 随着农业领域科学种植的发展&#xff0c;需要对农业基地及农事进行的信息化管理&#xff0c;为租户和农户等人员提供种植相…

opencv学习二值分析

内容来源于《opencv4应用开发入门、进阶与工程化实践》 二值分析&#xff1a; 常见的二值化方法&#xff1a; 基于全局阈值&#xff08;threshold&#xff09;得到的二值图像&#xff1b;基于自适应阈值&#xff08;adaptiveThreshold&#xff09;得到的二值图像&#xff1…