install

references:

helm3

$ curl -kL https://git.io/get_helm.sh | bash

# or
$ bash <(curl -k -fsSL https://git.io/get_helm.sh)
# or
$ bash <(curl -k -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3)
helm version
helm help

helm2

$ curl -fsSL \
       https://get.helm.sh/helm-v2.14.3-linux-amd64.tar.gz |
       sudo tar -xzv --strip-components=1 -C /usr/local/bin/

$ while read -r _i; do
    sudo chmod +x "/usr/local/bin/${_i}"
  done < <(echo helm tiller)

install plugin

$ echo '-k' >> ~/.curlrc
$ helm plugin install https://github.com/databus23/helm-diff

install apps

configuration

init

NOT suitable for helm3

$ helm init
$ helm init --client-only

$ kubectl create serviceaccount -n kube-system tiller
$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
$ kubectl patch deploy -n kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'

add repo

$ helm repo add jenkins https://charts.jenkins.io
$ helm repo update
  • search
    $ helm repo update
    $ helm search repo jenkins

default credential

$ kubectl get secrets <secret_name> \
              --namespace <namespace> \
              -o jsonpath="{.data.jenkins-admin-password}" |
          base64 --decode
$ kubectl get secrets <secret_name> \
              --namespace <namespace> \
              -o jsonpath="{.data.jenkins-admin-user}" |
          base64 --decode

usage

install Jenkins

$ helm repo add jenkins https://charts.jenkins.io
"jenkins" has been added to your repositories

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "jenkins" chart repository
Update Complete. ⎈Happy Helming!

$ helm repo list
NAME    URL
jenkins https://charts.jenkins.io

$ helm search repo jenkins
NAME            CHART VERSION APP VERSION DESCRIPTION
jenkins/jenkins 4.3.24        2.401.1     Jenkins - Build great things at any scale! The ...

$ helm show values jenkins/jenkins
$ helm show chart  jenkins/jenkins
$ helm show readme jenkins/jenkins
# or
$ helm show all jenkins/jenkins

$ helm --version=4.4.1 upgrade -i --reset-values -f=/path/to/value.yml staging-jenkins jenkins/jenkins
$ helm repo update
$ helm search repo -l jenkins
NAME                                    CHART VERSION   APP VERSION     DESCRIPTION

jenkins/jenkins                         4.6.4           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.6.3           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.6.2           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.6.1           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.6.0           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.5.1           2.414.1         Jenkins - Build great things at any scale! The ...
jenkins/jenkins                         4.5.0           2.401.3         Jenkins - Build great things at any scale! The ...
...

troubleshooting

  • Error: UPGRADE FAILED: "staging-jenkins" has no deployed releases

    $ /usr/local/bin/helm --version=4.5.0 upgrade -i --reset-values -f=/tmp/tmpqxn6qkck.yml staging-jenkins jenkins/jenkins
    Error: UPGRADE FAILED: "staging-jenkins" has no deployed releases
    • solution

      $ helm uninstall staging-jenkins
      release "staging-jenkins" uninstalled
      
      $ /usr/local/bin/helm --version=4.5.0 upgrade -i --reset-values -f=/tmp/tmpqxn6qkck.yml staging-jenkins jenkins/jenkins
      Release "staging-jenkins" does not exist. Installing it now.
      NAME: staging-jenkins
      LAST DEPLOYED: Tue Sep 19 23:05:30 2023
      NAMESPACE: devops
      STATUS: deployed
      REVISION: 1
      NOTES:
      1. Get your 'admin' user password by running:
        kubectl exec --namespace devops -it svc/staging-jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
      2. Get the Jenkins URL to visit by running these commands in the same shell:
        echo http://127.0.0.1:8080
        kubectl --namespace devops port-forward svc/staging-jenkins 8080:8080
      
      3. Login with the password from step 1 and the username: admin
      4. Configure security realm and authorization strategy
      5. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: http://127.0.0.1:8080/configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos
      
      For more information on running Jenkins on Kubernetes, visit:
      https://cloud.google.com/solutions/jenkins-on-container-engine
      
      For more information about Jenkins Configuration as Code, visit:
      https://jenkins.io/projects/jcasc/
      
      NOTE: Consider using a custom image with pre-installed plugins
  • tls: failed to verify certificate: x509

    $ helm repo add grafana https://grafana.github.io/helm-charts
    Error: looks like "https://grafana.github.io/helm-charts" is not a valid chart repository or cannot be reached: Get "https://grafana.github.io/helm-charts/index.yaml": tls: failed to verify certificate: x509: certificate signed by unknown authority
    • solution:
      $ helm repo add grafana --insecure-skip-tls-verify https://grafana.github.io/helm-charts
      "grafana" has been added to your repositories

check

$ kubectl get po staging-jenkins-0 -o 'jsonpath={.spec.containers[*].name}'
jenkins config-reload

$ kubectl get po staging-jenkins-0 -o 'jsonpath={.spec.containers[?(@.name=="jenkins")].image}'
jenkins/jenkins:2.401.2-lts-jdk11

$ kubectl get po staging-jenkins-0 -o 'jsonpath={.spec.containers[*].image}'
jenkins/jenkins:2.401.2-lts-jdk11 kiwigrid/k8s-sidecar:1.24.4

# format:
# --as=system:serviceaccount:<namespace>:<serviceaccount>
$ kubectl --as=system:serviceaccount:devops:staging-jenkins auth can-i get configmap/staging-jenkins-jcasc
yes
stdout
helm help

helm show

  • chart

    $ helm show chart jenkins/jenkins
    annotations:
      artifacthub.io/category: integration-delivery
      artifacthub.io/images: |
        - name: jenkins
          image: jenkins/jenkins:2.401.2-jdk11
        - name: k8s-sidecar
          image: kiwigrid/k8s-sidecar:1.24.4
        - name: inbound-agent
          image: jenkins/inbound-agent:3107.v665000b_51092-15
        - name: backup
          image: maorfr/kube-tasks:0.2.0
      artifacthub.io/license: Apache-2.0
      artifacthub.io/links: |
        - name: Chart Source
          url: https://github.com/jenkinsci/helm-charts/tree/main/charts/jenkins
        - name: Jenkins
          url: https://www.jenkins.io/
        - name: support
          url: https://github.com/jenkinsci/helm-charts/issues
    apiVersion: v2
    appVersion: 2.401.2
    description: Jenkins - Build great things at any scale! The leading open source automation
      server, Jenkins provides hundreds of plugins to support building, deploying and
      automating any project.
    home: https://jenkins.io/
    icon: https://get.jenkins.io/art/jenkins-logo/logo.svg
    keywords:
    - jenkins
    - ci
    - devops
    maintainers:
    - email: maor.friedman@redhat.com
      name: maorfr
    - email: mail@torstenwalter.de
      name: torstenwalter
    - email: garridomota@gmail.com
      name: mogaal
    - email: wmcdona89@gmail.com
      name: wmcdona89
    - email: timjacomb1@gmail.com
      name: timja
    name: jenkins
    sources:
    - https://github.com/jenkinsci/jenkins
    - https://github.com/jenkinsci/docker-inbound-agent
    - https://github.com/maorfr/kube-tasks
    - https://github.com/jenkinsci/configuration-as-code-plugin
    version: 4.4.1
  • values

    $ helm show values jenkins/jenkins
    

history

# get RELEASE_NAME
$ helm list
NAME            NAMESPACE  REVISION  UPDATED                                 STATUS    CHART         APP VERSION
staging-jenkins devops  11        2023-09-27 23:39:38.982931215 -0700 PDT deployed  jenkins-4.5.0 2.401.3

# get history
$ helm history staging-jenkins
REVISION  UPDATED                   STATUS      CHART         APP VERSION DESCRIPTION
2         Wed Sep 27 19:20:35 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
3         Wed Sep 27 20:18:10 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
4         Wed Sep 27 21:16:24 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
5         Wed Sep 27 21:18:01 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
6         Wed Sep 27 21:22:02 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
7         Wed Sep 27 21:31:07 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
8         Wed Sep 27 21:32:55 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
9         Wed Sep 27 21:35:42 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
10        Wed Sep 27 23:02:57 2023  superseded  jenkins-4.5.0 2.401.3     Upgrade complete
11        Wed Sep 27 23:39:38 2023  deployed    jenkins-4.5.0 2.401.3     Upgrade complete

status

# get RELEASE_NAME
$ helm list
NAME            NAMESPACE  REVISION  UPDATED                                 STATUS    CHART         APP VERSION
staging-jenkins devops     11        2023-09-27 23:39:38.982931215 -0700 PDT deployed  jenkins-4.5.0 2.401.3

# get status
$ helm status staging-jenkins
NAME: staging-jenkins
LAST DEPLOYED: Wed Sep 27 23:39:38 2023
NAMESPACE: devops
STATUS: deployed
REVISION: 11
NOTES:
1. Get your 'admin' user password by running:
  kubectl exec --namespace devops -it svc/staging-jenkins -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
  echo http://127.0.0.1:8080
  kubectl --namespace devops port-forward svc/staging-jenkins 8080:8080

3. Login with the password from step 1 and the username: admin
4. Configure security realm and authorization strategy
5. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: http://127.0.0.1:8080/configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos

For more information on running Jenkins on Kubernetes, visit:
https://cloud.google.com/solutions/jenkins-on-container-engine

For more information about Jenkins Configuration as Code, visit:
https://jenkins.io/projects/jcasc/

NOTE: Consider using a custom image with pre-installed plugins

get

get all

# get RELEASE_NAME
$ helm list
NAME            NAMESPACE  REVISION  UPDATED                                 STATUS    CHART         APP VERSION
staging-jenkins devops  11        2023-09-27 23:39:38.982931215 -0700 PDT deployed  jenkins-4.5.0 2.401.3

# get all including yaml
$ helm get all staging-jenkins

others

helm is compatible

HELM VERSION SUPPORTED KUBERNETES VERSIONS
3.11.x 1.26.x - 1.23.x
3.10.x 1.25.x - 1.22.x
3.9.x 1.24.x - 1.21.x
3.8.x 1.23.x - 1.20.x
3.7.x 1.22.x - 1.19.x
3.6.x 1.21.x - 1.18.x
3.5.x 1.20.x - 1.17.x
3.4.x 1.19.x - 1.16.x
3.3.x 1.18.x - 1.15.x
3.2.x 1.18.x - 1.15.x
3.1.x 1.17.x - 1.14.x
3.0.x 1.16.x - 1.13.x
2.16.x 1.16.x - 1.15.x
2.15.x 1.15.x - 1.14.x
2.14.x 1.14.x - 1.13.x
2.13.x 1.13.x - 1.12.x
2.12.x 1.12.x - 1.11.x
2.11.x 1.11.x - 1.10.x
2.10.x 1.10.x - 1.9.x
2.9.x 1.10.x - 1.9.x
2.8.x 1.9.x - 1.8.x
2.7.x 1.8.x - 1.7.x
2.6.x 1.7.x - 1.6.x
2.5.x 1.6.x - 1.5.x
2.4.x 1.6.x - 1.5.x
2.3.x 1.5.x - 1.4.x
2.2.x 1.5.x - 1.4.x
2.1.x 1.5.x - 1.4.x
2.0.x 1.4.x - 1.3.x
Copyright © marslo 2020-2023 all right reserved,powered by GitbookLast Modified: 2024-03-12 15:01:30

results matching ""

    No results matching ""