Jenkins 动态salve简单配置连接 EKS

安装Jenkins

helm repo add jenkins https://charts.jenkins.io
helm repo update
# 当前版本
jenkins-5.1.18.tgz

瘦身后的 values.yaml

# grep -Ev '^\s*#|^$' values.yaml
nameOverride:
fullnameOverride:
namespaceOverride:
clusterZone: "cluster.local"
kubernetesURL: "https://kubernetes.default"
credentialsId:
renderHelmLabels: true
controller:componentName: "jenkins-controller"image:registry: "docker.io"repository: "jenkins/jenkins"tag:tagLabel: jdk17pullPolicy: "Always"imagePullSecretName:lifecycle: {}disableRememberMe: falsenumExecutors: 0executorMode: "NORMAL"customJenkinsLabels: []hostNetworking: falseadmin:username: "admins"password:userKey: jenkins-admin-userpasswordKey: jenkins-admin-passwordcreateSecret: trueexistingSecret: ""jenkinsAdminEmail:jenkinsHome: "/var/jenkins_home"jenkinsRef: "/usr/share/jenkins/ref"jenkinsWar: "/usr/share/jenkins/jenkins.war"resources:requests:cpu: "50m"memory: "256Mi"limits:cpu: "4000m"memory: "4096Mi"shareProcessNamespace: falseinitContainerResources: {}initContainerEnvFrom: []initContainerEnv: []containerEnvFrom: []containerEnv: []javaOpts:jenkinsOpts:jenkinsUrlProtocol:jenkinsUrl:jenkinsUriPrefix:usePodSecurityContext: truerunAsUser: 1000fsGroup: 1000securityContextCapabilities: {}podSecurityContextOverride: ~containerSecurityContext:runAsUser: 1000runAsGroup: 1000readOnlyRootFilesystem: trueallowPrivilegeEscalation: falseserviceType: NodePortclusterIp:servicePort: 8080targetPort: 8080nodePort: 33441serviceExternalTrafficPolicy:serviceAnnotations: {}statefulSetLabels: {}serviceLabels: {}podLabels: {}healthProbes: trueprobes:startupProbe:failureThreshold: 12httpGet:path: '{{ default "" .Values.controller.jenkinsUriPrefix }}/login'port: httpperiodSeconds: 10timeoutSeconds: 5livenessProbe:failureThreshold: 5httpGet:path: '{{ default "" .Values.controller.jenkinsUriPrefix }}/login'port: httpperiodSeconds: 10timeoutSeconds: 5initialDelaySeconds:readinessProbe:failureThreshold: 3httpGet:path: '{{ default "" .Values.controller.jenkinsUriPrefix }}/login'port: httpperiodSeconds: 10timeoutSeconds: 5initialDelaySeconds:podDisruptionBudget:enabled: falseapiVersion: "policy/v1beta1"annotations: {}labels: {}maxUnavailable: "0"agentListenerEnabled: trueagentListenerPort: 50001agentListenerHostPort:agentListenerNodePort: 50001agentListenerExternalTrafficPolicy:agentListenerLoadBalancerSourceRanges:- 0.0.0.0/0disabledAgentProtocols:- JNLP-connect- JNLP2-connectcsrf:defaultCrumbIssuer:enabled: trueproxyCompatability: trueagentListenerServiceType: "NodePort"agentListenerServiceAnnotations: {}agentListenerLoadBalancerIP:legacyRemotingSecurityEnabled: falseloadBalancerSourceRanges:- 0.0.0.0/0loadBalancerIP:jmxPort:extraPorts: []installPlugins:- kubernetes:4219.v40ff98cfb_d6f- workflow-aggregator:596.v8c21c963d92d- git:5.2.2- configuration-as-code:1807.v0175eda_00a_20installLatestPlugins: trueinstallLatestSpecifiedPlugins: falseadditionalPlugins: []initializeOnce: falseoverwritePlugins: falseoverwritePluginsFromImage: trueprojectNamingStrategy: standardenableRawHtmlMarkupFormatter: falsemarkupFormatter: plainTextscriptApproval: []initScripts: {}initConfigMap:existingSecret:additionalExistingSecrets: []additionalSecrets: []secretClaims: []cloudName: "kubernetes"JCasC:defaultConfig: falseoverwriteConfiguration: falseconfigUrls: []configScripts: {}security:apiToken:creationOfLegacyTokenEnabled: falsetokenGenerationOnCreationEnabled: falseusageStatisticsEnabled: truesecurityRealm: |-local:allowsSignup: falseenableCaptcha: falseusers:- id: "${chart-admin-username}"name: "Jenkins Admin"password: "${chart-admin-password}"authorizationStrategy: |-loggedInUsersCanDoAnything:allowAnonymousRead: falsecustomInitContainers: []sidecars:configAutoReload:enabled: falseimage:registry: docker.iorepository: kiwigrid/k8s-sidecartag: 1.27.1imagePullPolicy: IfNotPresentresources: {}scheme: httpskipTlsVerify: falsereqRetryConnect: 10sleepTime:envFrom: []env: {}sshTcpPort: 1044folder: "/var/jenkins_home/casc_configs"containerSecurityContext:readOnlyRootFilesystem: trueallowPrivilegeEscalation: falseadditionalSidecarContainers: []schedulerName: ""nodeSelector: {}tolerations: []terminationGracePeriodSeconds:terminationMessagePath:terminationMessagePolicy:affinity: {}priorityClassName:podAnnotations: {}statefulSetAnnotations: {}updateStrategy: {}ingress:enabled: falsepaths: []apiVersion: "extensions/v1beta1"labels: {}annotations: {}path:hostName:resourceRootUrl:tls: []secondaryingress:enabled: falsepaths: []apiVersion: "extensions/v1beta1"labels: {}annotations: {}hostName:tls:backendconfig:enabled: falseapiVersion: "extensions/v1beta1"name:labels: {}annotations: {}spec: {}route:enabled: falselabels: {}annotations: {}path:hostAliases: []prometheus:enabled: falseserviceMonitorAdditionalLabels: {}serviceMonitorNamespace:scrapeInterval: 60sscrapeEndpoint: /prometheusalertingrules: []alertingRulesAdditionalLabels: {}prometheusRuleNamespace: ""relabelings: []metricRelabelings: []googlePodMonitor:enabled: falsescrapeInterval: 60sscrapeEndpoint: /prometheustestEnabled: truehttpsKeyStore:enable: falsejenkinsHttpsJksSecretName: ""jenkinsHttpsJksSecretKey: "jenkins-jks-file"jenkinsHttpsJksPasswordSecretName: ""jenkinsHttpsJksPasswordSecretKey: "https-jks-password"disableSecretMount: falsehttpPort: 8081path: "/var/jenkins_keystore"fileName: "keystore.jks"password: "password"jenkinsKeyStoreBase64Encoded:
agent:enabled: falsedefaultsProviderTemplate: ""jenkinsUrl:jenkinsTunnel:kubernetesConnectTimeout: 5kubernetesReadTimeout: 15maxRequestsPerHostStr: "32"retentionTimeout: 5waitForPodSec: 600namespace:podLabels: {}jnlpregistry:image:repository: "jenkins/inbound-agent"tag: "3248.v65ecb_254c298-1"workingDir: "/home/jenkins/agent"nodeUsageMode: "NORMAL"customJenkinsLabels: []imagePullSecretName:componentName: "jenkins-agent"websocket: falsedirectConnection: falseprivileged: falserunAsUser:runAsGroup:hostNetworking: falseresources:requests:cpu: "512m"memory: "512Mi"limits:cpu: "512m"memory: "512Mi"livenessProbe: {}alwaysPullImage: falserestrictedPssSecurityContext: falsepodRetention: "Never"showRawYaml: truevolumes: []workspaceVolume: {}envVars: []secretEnvVars: []nodeSelector: {}command:args: "${computer.jnlpmac} ${computer.name}"sideContainerName: "jnlp"TTYEnabled: falsecontainerCap: 10podName: "default"idleMinutes: 0yamlTemplate: ""yamlMergeStrategy: "override"connectTimeout: 100annotations: {}additionalContainers: []disableDefaultAgent: falsepodTemplates: {}
additionalAgents: {}
additionalClouds: {}
persistence:enabled: trueexistingClaim:storageClass: openebs-hostpathannotations: {}labels: {}accessMode: "ReadWriteOnce"size: "8Gi"dataSource: {}subPath:volumes: []mounts: []
networkPolicy:enabled: falseapiVersion: networking.k8s.io/v1internalAgents:allowed: truepodLabels: {}namespaceLabels: {}externalAgents:ipCIDR:except: []
rbac:create: truereadSecrets: false
serviceAccount:create: truename:annotations: {}extraLabels: {}imagePullSecretName:
serviceAccountAgent:create: falsename:annotations: {}extraLabels: {}imagePullSecretName:
checkDeprecation: true
awsSecurityGroupPolicies:enabled: falsepolicies:- name: ""securityGroupIds: []podSelector: {}
helmtest:bats:image:registry: "docker.io"repository: "bats/bats"tag: "1.11.0"

在这里插入图片描述

安装完之后 配置EKS

我的是在tools命名空间下
---
apiVersion: v1
kind: ServiceAccount
metadata:name: tools-adminnamespace: tools---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:name: pod-creatornamespace: tools
rules:
- apiGroups: [""] # "" indicates the core API groupresources: ["pods"]verbs: ["create", "get", "list", "watch", "delete", "update"]---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:name: tools-admin-rolebindingnamespace: tools
subjects:
- kind: ServiceAccountname: tools-adminnamespace: tools
roleRef:kind: Rolename: pod-creatorapiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:name: tools-admin-crb
roleRef:apiGroup: rbac.authorization.k8s.iokind: ClusterRolename: cluster-admin
subjects:
- kind: ServiceAccountname: tools-adminnamespace: tools---
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:annotations:kubernetes.io/service-account.name: tools-adminname: tools-admin-tokennamespace: tools

获取你的token

echo -e "\033[31m$(kubectl -n tools get secret $(kubectl -n tools get secret tools-admin-token | grep tools-admin-token | awk '{print $1}') -o go-template='{{.data.token}}' | base64 -d)\033[0m"

在这里插入图片描述

登录Jenkins 配置eks的token

在这里插入图片描述

最后pipeline如下
pipeline {agent { kubernetes {inheritFrom 'kubernetes'}}   stages {stage('Get Code') {steps {  git branch: 'main', url: 'http://192.168.0.33:22045/admins/test.git'}}stage('Test-docker....') {steps {       container('test'){withKubeConfig(credentialsId: 'k8s-eks', serverUrl: 'https://01922.gr7.ap-northeast-1.eks.amazonaws.com') {sh 'kubectl delete -f pods.yaml'sh 'kubectl get pods'}}}}}}

运行日志

在这里插入图片描述

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

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

相关文章

C#对文件进行批量重命名或者对某个单独的文件进行改名

目录 一、FolderBrowserDialog 二、OpenFileDialog 三、Path 四、ui设计 五、代码部分 一、FolderBrowserDialog FolderBrowserDialog是一个用于选择文件夹的对话框控件,可以在windows Forms应用程序中使用。使用它可以让用户选择一个文件夹,并返…

Kubernetes 之硬盘持久化和 EmptyDir 与 HostPath 挂载类型

Kubernetes 之硬盘持久化和 EmptyDir 与 HostPath 挂载类型 持久化存储的意义 在 Kubernetes 中部署的应用都是以 Pod 的方式运行的。大部分情况这些 Pod 是无状态的。但是假如我们部署数据库或者需要一个存放关键文件的文件夹的时候,这时候我们就需要存储持久化以…

ShardingSphere如何完成与Spring家族无缝整合的?

系统集成即ShardingSphere 和 Spring 框架的集成。 ShardingSphere 实现两种系统集成机制: 命名空间(namespace)机制,通过扩展 Spring Schema 来实现与 Spring 框架的集成编写自定义 starter 组件完成与 Spring Boot 的集成 1 …

需求:实现一个可以统计代码的运行时间

需求:有一个做加法计算的函数,要统计执行这个加法函数代码运行了多久 import timedef add(a, b):time.sleep(1)return a bst time.time() add(100, 200) et time.time() print("该函数运行时间为:", et - st) 学了闭包&#x…

文件批量替换

替换yaml文件中的kube-system成ck find . -type f -name "*.yaml" -exec sed -i s/kube-system/ck/g {} \;

实现C++ Stack(顺序栈)

参考QStack&#xff0c;继承自Vector 类声明 template<typename T>class Stack :protected Vector<T>{public:explicit Stack()noexcept;Stack(const Stack&t)noexcept;Stack(Stack&&t)noexcept;Stack& operator (const Stack& t)noexcept;S…

C#面:请解释转发与跳转的区别

在C#中&#xff0c;转发&#xff08;forwarding&#xff09;和跳转&#xff08;jumping&#xff09;是两种不同的控制流程操作。 转发 是指将控制权从一个方法或函数转移到另一个方法或函数。在转发中&#xff0c;程序会将当前的执行状态传递给另一个方法&#xff0c;并在该方…

【EventSource错误解决方案】设置Proxy后SSE发送的数据只在最后接收到一次,并且数据被合并

【EventSource错误解决方案】设置Proxy后SSE发送的数据只在最后接收到一次&#xff0c;并且数据被合并 出错描述 出错原因与解决方案 出错描述 SSE前后端一切正常&#xff0c;但是fetchEventSource 的onmessage回调函数只在所有流都发送完毕后&#xff0c;才会执行一次。 前…

【编译原理复习笔记】中间语言

中间语言 中间语言的特点和作用 &#xff08;1&#xff09;独立于机器 &#xff08;2&#xff09;复杂性介于源语言和目标语言之间 中间语言可以使编译程序的结构在逻辑上更为简单明确 常用的中间语言 后缀式 图表示&#xff1a;抽象语法树&#xff0c;有向无环图 三地址代…

Elasticsearch的复制功能

Elasticsearch的复制功能 Elasticsearch的复制功能确保了数据的高可用性和耐久性。当一个节点临时下线&#xff0c;其上承载的主分片&#xff08;primary shards&#xff09;将不可用。但是&#xff0c;副本分片&#xff08;replica shards&#xff09;会继续提供服务。以下是…

【软件设计师】先导

一、考试科目&#xff1a; 上午&#xff1a;计算机与软件工程知识&#xff0c;考试时间150min&#xff0c;75空单选题&#xff08;不一定一题一空&#xff09; 下午&#xff1a;软件设计&#xff0c;考试时间150分钟&#xff0c;问答题&#xff0c;6道只做5大题&#xff08;前四…

【论文阅读】Prompt Fuzzing for Fuzz Driver Generation

文章目录 摘要一、介绍二、设计2.1、总览2.2、指导程序生成2.3、错误程序净化2.3.1、执行过程净化2.3.2、模糊净化2.3.3、覆盖净化 2.4、覆盖引导的突变2.4.1、功率调度2.4.2、变异策略 2.5、约束Fuzzer融合2.5.1、论据约束推理2.5.1、模糊驱动融合 三、评估3.1、与Hopper和OSS…

Android Room 使用模版

文章目录 一、配置依赖 plugins {id kotlin-kapt }android {compileOptions {sourceCompatibility JavaVersion.VERSION_17targetCompatibility JavaVersion.VERSION_17}kotlinOptions {jvmTarget 17} }dependencies {implementation("androidx.room:room-runtime:2.4.2&…

【一站式学会Kotlin】第十节:kotlin 语言的可控性特点和安全调用操作符

作者介绍: 百度资深Android工程师T6,在百度任职7年半。 目前:成立赵小灰代码工作室,欢迎大家找我交流Android、微信小程序、鸿蒙项目。= 一:通俗易懂的人工智能教程:https://www.captainbed.cn/nefu/ 点一下,打开新世界的大门。 二:【一站式学会Kotlin】免费领取:作者…

QTextEdit将多个字符作为一个整体,不可单独修改

考虑一个问题&#xff0c;QTextEdit如何实现类似微信和QQ聊天输入框中的“xxx”效果&#xff0c;其内容作为一个整体&#xff0c;以突出颜色显示&#xff0c;并且不可以单独编辑修改&#xff0c;只能整体删除修改。 突出颜色显示有很多方式可以实现&#xff0c;例如 通过setT…

Rust学习心得

我分享一下一年的Rust学习经历&#xff0c;从书到代码都一网打尽。 关于新手如何学习Rust&#xff0c;我之前在Hacker News上看到了这么一篇教程&#xff1a; 这篇教程与其他教程不同的时&#xff0c;他不是一个速成教程&#xff0c;而是通过自己的学习经历&#xff0c;向需要…

记录一次Netty的WSS异常

概述 业务场景 应用通过 WSS 客户端连接三方接口。在高并发压测时&#xff0c;出现了请求服务器写入失败的异常&#xff0c;该异常是偶发&#xff0c;出现的概率不到千分之一&#xff0c;异常如下图所示。 问题概述 注意&#xff1a; 因为握手是通过 http 协议进行的。所以…

tcpdump源码分析

进入tcpdump.c&#xff08;函数入口&#xff09;之前&#xff0c;先看一些头文件netdissect.h里定义了一个数据结构struct netdissect_options来描述tcdpump支持的所有参数动作&#xff0c;每一个参数有对应的flag, 在tcpdump 的main 里面&#xff0c; 会根据用户的传入的参数来…

鸿蒙ArkTS声明式开发:跨平台支持列表【触摸事件】

触摸事件 当手指在组件上按下、滑动、抬起时触发。 说明&#xff1a; 开发前请熟悉鸿蒙开发指导文档&#xff1a; gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md点击或者复制转到。 从API Version 7开始支持。后续版本如有新增内容&#xff0c;则采用上角标单独…

总是等不是办法,向媒体投稿你得学会用新方法

初入信息宣传领域,我怀揣着对文字的热爱与传播价值的热情,肩负起了单位活动的宣传报道重任。那时的我,满脑子都是传统的投稿思维:精心撰写每一篇稿件,然后逐一搜寻各大媒体的投稿邮箱,一封封邮件满怀期待地发出,像播撒希望的种子,渴望在广袤的媒体土壤中生根发芽。然而,理想很丰…