<p>I am trying to setup Kubernetes for my company.  I have looked a good amount into Jenkins X and, while I really like the roadmap, I have come the realization that it is likely not mature enough for my company to use at this time.  (<a href="https://docs.cloudbees.com/docs/cloudbees-jenkins-x-distribution/latest/user-interface/" rel="nofollow noreferrer">UI in preview</a>, <a href="https://github.com/jenkins-x/jx/issues/6352" rel="nofollow noreferrer">flaky command line</a>, <a href="https://github.com/jenkins-x/jx/issues/6398" rel="nofollow noreferrer">random IP address needs</a> and poor windows support are a few of the issues that have lead me to that conclusion.)</p>

<p>But I understand that the normal Jenkins is very mature and can run on Kubernetes.  I also understand that it can have dynamically created build agents run in the cluster.</p>

<p>But I am not sure about gitops support.  When I try to google it (<code>gitops jenkins</code>) I get a bunch of information that includes Jenkins X.</p>

<p><strong>Is there an easy(ish) way for normal Jenkins to use GitOps?  If so, how?</strong></p>

<p><strong>Update:</strong><br>
By GitOps, I mean something similar to what Jenkins X supports.  (Meaning changes to the cluster stored in a Git repository.  And merging causes a deployment.)</p>

Vaccano
<blockquote>
  <p>I mean something similar to what Jenkins X supports. (Meaning changes to the cluster stored in a Git repository. And merging causes a deployment.)</p>
</blockquote>

<p>Yes, this is the what Jenkins (or other CICD tools) do. You can declare a deployment pipeline in a <a href="https://jenkins.io/doc/book/pipeline/jenkinsfile/" rel="nofollow noreferrer">Jenkinsfile</a> that is triggered on merge (commit to master) and have other steps for other branches (if you want).</p>

<p>I recommend to deploy with <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/" rel="nofollow noreferrer">kubectl using kustomize</a> and store the config files in your Git repository. You <em>parameterize</em> different environments e.g. staging and production with <a href="https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/#bases-and-overlays" rel="nofollow noreferrer">overlays</a>. You may e.g. deploy with only 2 replicas in staging but with 6 replicas and more memory resources in production.</p>

<p>Using Jenkins for this, I would create a <a href="https://jenkins.io/doc/book/pipeline/docker/" rel="nofollow noreferrer">docker agent image</a> with <code>kubectl</code>, so your <em>steps</em> can use the <code>kubectl</code> command line tool.</p>

<p><strong>Jenkins on Kubernetes</strong></p>

<blockquote>
  <p>But I understand that the normal Jenkins is very mature and can run on Kubernetes. I also understand that it can have dynamically created build agents run in the cluster.</p>
</blockquote>

<p>I have not had the best experience with this. It may work - or it may not work so well. I currently host Jenkins outside the Kubernetes cluster. I think that <a href="https://jenkins-x.io/blog/2019/02/19/jenkins-x-next-gen-pipeline-engine/" rel="nofollow noreferrer">Jenkins X</a> together with <a href="https://tekton.dev/" rel="nofollow noreferrer">Tekton</a> may be an upcoming promising solution for this, but I have not tried that setup.</p>
