jenkins对接K8S

news2024/11/18 19:50:36

创建连接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'
LS0tLS1CRUdJTiBDRVJUSUZJQ0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nBrSkxMVwp0YVNzRms5UnNNdFBjcXFjSmdPL3JGelVuMDRhRHdJREFRQUJvMUF3VGpBZEJnTlZIUTRFRmdRVU9kZFI1dlhYCk5kaWZWRmFNWjRUZ0FQY0U3L1F3SHdZRFZSMGpCQmd3Rm9BVU9kZFI1dlhYTmRpZlZGYU1aNFRnQVBjRTcvUXcKREFZRFZSMFRCQVV3QXdFQi96QU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFXTnA2Nm05QjJOZWUyaHdLbmo1awp6WDY2d0YrbkFrQlVFbEhQeDlsZDBKcVhDaDRUZ2RNcGR0ckRaNG1CUS9oUXVpaThtQjQ2TFlDM2VtVGYvRGJMCkxnSUN2eVhlLythWjY1MkVBeFNtUndpU3FOaHFGc09hcUx1UlVialpRKzNvRmt0WVlVN0pFcWs2bnlub3hUR0oKeDFBQU45cFdXdkRPT09tNHpscGdxY3Y4cnpEL1MweEZoaWFWVnR6N29KeGVsdllpTzFlclJybDB3a2Y0SnlJVwpPTlNIZ0VXaVFTRTFUNHp2WHV3MHI2MndXRUs2ZktFYXZHYWtHU3B5YWxjcFVPTE01YmE3dnZzOWRTRWVGZEhhClZUL0xXWTA1RmJBN1hzOXd4SnNMS2djeEVzM2Y3dkVaaGhQRTJjZHpPeG9ra3B6NjdqZHN6QVZCbzZWQlA5SHoKR1E9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
    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
                        '''
                    }
                }
            }
        }
    }
}
创建一个流水然后进行测试的结果如下

请添加图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

使用vscode查bug

具体操作 修改CMakeList.txt # set(CMAKE_BUILD_TYPE "Release")//注释Release模式 set(CMAKE_BUILD_TYPE "Debug")//设置为Debug模式 # set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")//注释*这行代码是用来设置 CMake 构建系统中 Release 模式…

Go Zero微服务个人探究之路(十)实战走通微服务前台请求调用的一套流程model->rpc微服务->apiHTTP调用

前言 Go语言凭借低占用&#xff0c;高并发等优秀特性成为后台编程语言的新星&#xff0c;GoZero框架由七牛云技术副总裁团队编写&#xff0c;目前已经成为Go微服务框架里star数量最多的框架 本文记录讲述笔者一步步走通前台向后台发出请求&#xff0c;后台api调用rpc服务的相…

verilog编程之乘法器的实现

知识储备 首先来回顾一下乘法是如何在计算机中实现的。 假设现在有两个32位带符号定点整数x和y&#xff0c;我们现在要让x和y相乘&#xff0c;然后把乘积存放在z中&#xff0c;大家知道&#xff0c;两个32位数相乘&#xff0c;结果不会超过64位&#xff0c;因此z的长度应该为64…

总结6(循环(for))

循环 定义&#xff1a; 某些代码会被重复执行 分类&#xff1a; for 1.格式 for(1; 2; 3) 语句A; 2.执行的流程&#xff08;1,2,A,3 2,A,3 2,A,3..........&#xff09; 单个for循环的使用 多个for循环的嵌套使用 1). for&#xff08;1; 2; 3&#xff09; for&#xff0…

用通俗易懂的方式讲解:一种全新的大模型检索增强生成方法

如何使大型语言模型更加事实、正确和可靠&#xff1f; 检索增强生成&#xff08;RAG&#xff09;是一种有效的方法&#xff0c;可以缓解大型语言模型的基本局限性&#xff0c;如幻觉和缺乏最新知识。 然而&#xff0c;如果您曾尝试过RAG&#xff0c;您会同意我所说的RAG易于原…

【每日一题】4.LeetCode——环形链表

&#x1f4da;博客主页&#xff1a;爱敲代码的小杨. ✨专栏&#xff1a;《Java SE语法》 ❤️感谢大家点赞&#x1f44d;&#x1f3fb;收藏⭐评论✍&#x1f3fb;&#xff0c;您的三连就是我持续更新的动力❤️ &#x1f64f;小杨水平有限&#xff0c;欢迎各位大佬指点&…

RK3568平台开发系列讲解(Linux系统篇)互斥锁使用

🚀返回专栏总目录 文章目录 一、互斥锁API二、使用互斥锁的步骤三、互斥锁使用规则四、使用案例沉淀、分享、成长,让自己和他人都能有所收获!😄 一、互斥锁API 在Linux中,你可以使用互斥锁(Mutex)来实现多线程或多进程之间的互斥访问。互斥锁用于确保在同一时间只有一…

24. 两两交换链表中的节点(力扣LeetCode)

文章目录 24. 两两交换链表中的节点题目描述解题思路只使用一个临时节点使用两个临时节点 24. 两两交换链表中的节点 题目描述 给你一个链表&#xff0c;两两交换其中相邻的节点&#xff0c;并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题&#xff0…

STM32学习笔记(二) —— 调试串口

我们在调试程序时&#xff0c;经常会使用串口打印相关的调试信息&#xff0c;但是单片机串口不能直接与 PC 端的 USB 接口通讯&#xff0c;需要用到一个USB转串口的芯片来充当翻译的角色。我们使用的开发板上有这个芯片&#xff0c;所以在打印调试信息的时候直接使用USB线连接开…

每日一题——LeetCode1365.有多少小于当前数字的数字

方法一 暴力循环 对于数组里的没一个元素都遍历一遍看有多少元素小于当前元素 var smallerNumbersThanCurrent function(nums) {let n nums.length;let ret [];for (let i 0; i < n; i) {let count 0;for (let j 0; j < n; j) {if (nums[j] < nums[i]) {count…

【C语言】数组的应用:三子棋游戏

由于代码较长&#xff0c;为了增加可读性&#xff0c;我们把代码分别写到game.h&#xff0c;game.c&#xff0c;test.c&#xff0c;里面&#xff0c;其中game.h用来声明函数&#xff0c;实现函数功能的代码在game.c&#xff0c;测试游戏的代码在test.c 为了方便后续的更改&…

qt学习:http+访问百度智能云api实现车牌识别

目录 登录到百度智能云&#xff0c;找到文字识别 完成操作指引 开通 查看车牌识别的api文档 ​编辑​编辑 查看自己应用的api key 查看回应的数据格式 编程步骤 ui界面编辑 添加模块&#xff0c;头文件和定义变量 新建两个类&#xff0c;一个图像Image类&#xff0c…

深度学习之卷积神经网络进阶版

上一讲我们介绍了卷积神经网络和多层感知机&#xff0c;也就是全链接网络。他们在网络架构上是串行的结构&#xff0c;也就是在每一层与每一层之间&#xff0c;前面一层的输出&#xff0c;是后面一层的输入。 在神经网络里面&#xff0c;我们可能会有更加复杂的结构&#xff0…

Pycharm连接云算力远程服务器(AutoDL)训练深度学习模型全过程

前言&#xff1a;在上一篇windows搭建深度学习环境中&#xff0c;我试图使用笔记本联想小新air14的mx350显卡训练一个图像检测的深度学习模型&#xff0c;但是训练时长大概需要几天时间远超我的预期&#xff0c;所以我便选择租用GPU进行训练&#xff0c;在对多家平台对比后找到…

[BT]小迪安全2023学习笔记(第19天:Web开发-.NET项目)

第19天 名词解释 .NET 是一种由Microsoft开发的软件框架&#xff0c;用于构建和运行Windows操作系统上的应用程序。它提供了一个广泛的工具和库集合&#xff0c;支持多种编程语言&#xff0c;包括C#、VB.NET、F#等。.NET的主要目标是提供一种一致的开发平台&#xff0c;使开发…

《HTML 简易速速上手小册》第1章:HTML 入门(2024 最新版)

文章目录 1.1 HTML 简介与历史&#xff08;&#x1f609;&#x1f310;&#x1f47d;踏上神奇的网页编程之旅&#xff09;1.1.1 从过去到现在的华丽蜕变1.1.2 市场需求 —— HTML的黄金时代1.1.3 企业中的实际应用 —— 不只是个网页1.1.4 职业前景 —— 未来属于你 1.2 基本 H…

SQL注入:二次注入

SQL注入系列文章&#xff1a; 初识SQL注入-CSDN博客 SQL注入&#xff1a;联合查询的三个绕过技巧-CSDN博客 SQL注入&#xff1a;报错注入-CSDN博客 SQL注入&#xff1a;盲注-CSDN博客 目录 什么是二次注入&#xff1f; 二次注入演示 1、可以注册新用户 2、可以登录->…

数据湖技术之平台建设篇2

数据湖技术之平台建设篇1&#xff0c;主要介绍了湖仓平台建设的前三个主要工作&#xff0c;本次主要继续上次的建设工作介绍&#xff0c;聊一聊一站式湖仓服务平台的相关管理能力建设以及针对小文件的处理。 一. 一站式湖仓服务平台的相关管理能力 主要是将相关能力落地到平台…

day03-今日佳人功能实现

课程说明 首页功能说明系统架构说明实现今日佳人功能实现推荐用户的列表接口增加缓存功能整合前端联调测试 1、首页 在用户登录成功后&#xff0c;就会进入首页&#xff0c;首页中有今日佳人、推荐好友、探花、搜附近等功能。 2、系统架构 在开发完SSO系统中的登录功能后&…

【Spring实战】31 Spring Boot3 集成 Gateway 微服务网关

文章目录 1. 定义2. 功能3. 示例代码1) 创建一个业务服务2&#xff09;创建一个网关服务3&#xff09;启动服务4&#xff09;验证 4. 代码参考结语 1. 定义 Spring Cloud Gateway 是一个基于 Spring Framework 的开源网关服务&#xff0c;用于构建微服务架构中的 API 网关。它…