{"id":1898,"date":"2020-04-10T14:31:17","date_gmt":"2020-04-10T11:31:17","guid":{"rendered":"https:\/\/artem.services\/?p=1877"},"modified":"2020-04-15T16:48:48","modified_gmt":"2020-04-15T13:48:48","slug":"1898","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1898&lang=en","title":{"rendered":"Jenkins &#8212; Kubeconfig"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-819\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png\" alt=\"\" width=\"1280\" height=\"412\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo.png 1280w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-300x97.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-768x247.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-1024x330.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2019\/02\/Jenkins-Logo-954x307.png 954w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>To store and switch between <strong>Kubernetes<\/strong> configurations, you can use the <a href=\"https:\/\/plugins.jenkins.io\/kubernetes-cli\/\" target=\"_blank\" rel=\"noopener noreferrer\">Kubernetes CLI<\/a> plugin, to work with it, &quot;<strong>kubectl<\/strong>&quot; must be installed in the system<\/p>\n<h3>Install the plugin<\/h3>\n<p>Go to &quot;<strong>Manage Jenkins<\/strong>&quot;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1782\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001.png\" alt=\"\" width=\"349\" height=\"383\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001.png 349w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/001-273x300.png 273w\" sizes=\"(max-width: 349px) 100vw, 349px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Section &quot;<strong>Manage Plugins<\/strong>&quot;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1783\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002.png\" alt=\"\" width=\"927\" height=\"493\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002.png 927w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002-300x160.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2020\/03\/002-768x408.png 768w\" sizes=\"(max-width: 927px) 100vw, 927px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Go to the &quot;<strong>Available<\/strong>&quot; tab and in the search indicate &quot;<strong>Kubernetes CLI<\/strong>&quot;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1878\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05.png\" alt=\"\" width=\"2182\" height=\"606\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05.png 2182w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-300x83.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-1024x284.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-768x213.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-1536x427.png 1536w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-2048x569.png 2048w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-954x265.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-12.58.05-1354x376.png 1354w\" sizes=\"(max-width: 2182px) 100vw, 2182px\" \/><\/p>\n<p>Install it.<\/p>\n<p>&nbsp;<\/p>\n<h3>Add Kubernetes config<\/h3>\n<p>&nbsp;<\/p>\n<p>Go to the &quot;<strong>Credentials<\/strong>&quot; and create the &quot;<strong>Secret file<\/strong>&quot;<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1879\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57.png\" alt=\"\" width=\"2152\" height=\"608\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57.png 2152w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-300x85.png 300w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-1024x289.png 1024w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-768x217.png 768w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-1536x434.png 1536w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-2048x579.png 2048w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-954x270.png 954w, https:\/\/artem.services\/wp-content\/uploads\/2020\/04\/Screenshot-2020-04-10-at-13.16.57-1354x383.png 1354w\" sizes=\"(max-width: 2152px) 100vw, 2152px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We load a config and we specify &quot;<strong>ID<\/strong>&quot;. Save.<\/p>\n<p>&nbsp;<\/p>\n<h3>Pipeline<\/h3>\n<p>An example of using a plugin in <strong>Pipeline<\/strong>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\npipeline {\r\n  agent any\r\n  stages {   \r\n    stage(&quot;K8s&quot;) {\r\n      steps {\r\n        withKubeConfig([credentialsId: 'kubeconfig-artem-services-staging']) {\r\n          script {\r\n            sh &quot;kubectl get pod&quot;\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; To store and switch between Kubernetes configurations, you can use the Kubernetes CLI plugin, to work with it, &quot;kubectl&quot; must be installed in the system Install the plugin Go to &quot;Manage Jenkins&quot; &nbsp; Section &quot;Manage Plugins&quot; &nbsp; Go to the &quot;Available&quot; tab and in the search indicate &quot;Kubernetes CLI&quot; Install it. &nbsp; Add Kubernetes &hellip; <a href=\"https:\/\/artem.services\/?p=1898&#038;lang=en\" class=\"more-link\">\u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u044c<span class=\"screen-reader-text\"> &quot;Jenkins &#8212; Kubeconfig&quot;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[613,559],"tags":[779,617,1093,551,1567,1247],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1898"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1898"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1898\/revisions"}],"predecessor-version":[{"id":1900,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1898\/revisions\/1900"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}