Feasibility of Kubernetes helm deploying using Helm client from Jenkins pipeline job - jenkins

I am trying to implement the Kubernetes service deployment using Kubernetes helm chart. Actually I am using Jenkins pipeline job for deployment. And Jenkins is installed out side of Kubernetes cluster. So If I am using Helm in the machine where Jenkins is installed , then can I use Helm deployment command inside on Jenkins pipeline job?
If I am calling "helm install" command inside one Jenkins pipeline job ? Does it deploy into remote Kubernetes cluster? Because I am installing Jenkins out side of Kubernetes cluster.

If I am calling "helm install" command inside one jenkins pipeline job
? Does it deploy into remote kubernetes cluster?
Yes. You need a ~/.kube/config file, network access to the k8s API, kubectl and helm to make it work.
Here's a good read explaining helm https://next.nutanix.com/kubernetes-containers-30/tillerless-helm-on-nutanix-karbon-31334

Related

How to use HELM with Containerized Jenkins in Kubernetes cluster

I am implementing CICD with jenkins, Gitea and kaniko on Kubernetes cluster. Since the Jenkins is containerized, we have used kaniko to build and push the image to GCR registry. Now, I need to update the latest image tag in helm chart values file and install this with helm install on kubernetes cluster as a part of CD.
Somehow, I am not able to install Helm on jenkins container (it doenst allow root) or there is no helm plugin available in jenkins. How can I proceed with using helm in my CICD with containerized jenkins.

How to handle "docker-in-docker" problem when using Jenkins inside K8S

New to Kubernetes, a little complex question needs help.
Background
Using Jenkins in GKE (Google Kubernetes Engine)
Want to use jenkins-docker plugin to provide the specific test environment for each type of tests
Don't want to mixin docker binary in the Jenkins image (because it is large)
Don't want docker-in-docker
More specifically, I don't want the Jenkins Pod be a new Docker Server
What I want
Each test environment can create a new pod in GKE Cluster, rather than creating containers inside the Jenkins Pod
P.S.
I have just read some articles, but half of them are telling about "how to use K8S to scale up the Jenkins (using jenkins-slave + jenkins-kubernates plugin)", another half are telling about how to "use docker plugin in a dockerized jenkins container on a bare metal machine (you can use /var/run/docker.sock to communicate between the host and the docker container)", but I cannot find **how to use docker plugin (to provide a specific environment) in a dockerized jenkins container inside K8S

Kubernetes Jenkins connectivity Issue

I set up the kubernetes on EC2 instances over ubuntu platform, everything working fine. But now I have deployed a Jenkins pod, after that, I am able to access the Jenkins in the browser. Now my question is how can I connect Jenkins with my machine.
My Jenkins pod IP:- 10.43.0.8
My Kubernetes Master private IP:- 192.168.105.229
I am able to ping with each other. But how I can access my master machine using Jenkins, so I can create the pods through Jenkins.
There are a few ways to do this. A couple that I can think of:
Use the Jenkins Kubernetes Plugin. If you install this on your Jenkins master (which is also running on a pod) and also if you configure it to talk to the same Kubernetes cluster (meaning the kube-apiserver) then you can create/remove pods using the plugin. More on how to configure authentication and RBAC in Kubernetes
Manually configure Jenkins slaves running as 'user'. Then on the 'user's some directory create a ~/.kube/config that has the configuration to talk to your Kubernetes cluster. From there you can just issue kubectl commands to create/remove pods. You would still need to configure authentication/RBAC.
If you want to access a pod running in Kubernetes you need to expose it as a service and possibly an ingress resource
https://kubernetes.io/docs/concepts/services-networking/service/

How to deploy K8 apps in k8 Cluster through Jenkins?

I tried to use the Kubernetes Continuous Deploy Plugin but its seem it ran on the slave and deploy the app, but I want to deploy K8 Apps in K8 cluster not in jenkins slave.
As it described at wiki-pages you need configure access to your kubernetes cluster.
From documentation:
In the "Kubeconfig" dropdown, select the > kubeconfig stored in Jenkins.
in kubeconfig you store the access to your cluster, without this it would not work.

Running docker containers as Jenkins Slave

I have Jenkins installed on my system and I want to run docker containers as Jenkins slave.
I am confused with the configuration part of jenkins after installing docker plugin.
What should I enter in those settings?
You'll need to edit Jenkins system configuration (Jenkins > Manage > System configuration) and add a new Cloud of type "Docker"
That means you need to have docker installed in a cloud (a local one like VirtualBox, or a remote one, like Amanzon EC2.
See for instance "Using Docker as a Jenkins Cloud Provider".

Resources