Difference between revisions of "Kubernetes/Helm"
Jump to navigation
Jump to search
Line 49: | Line 49: | ||
https://cloud.google.com/solutions/jenkins-on-container-engine | https://cloud.google.com/solutions/jenkins-on-container-engine | ||
</pre> | </pre> | ||
= Create a chart = | |||
<source lang=bash> | |||
helm version --short # -> v3.1.3+g0a9a9a8 | |||
helm create diy # diy = [NAME] | |||
$> tree 1chart | |||
1chart | |||
├── charts | |||
├── Chart.yaml | |||
├── templates | |||
│ ├── deployment.yaml | |||
│ ├── _helpers.tpl | |||
│ ├── ingress.yaml | |||
│ ├── NOTES.txt | |||
│ ├── serviceaccount.yaml | |||
│ ├── service.yaml | |||
│ └── tests | |||
│ └── test-connection.yaml | |||
└── values.yaml | |||
helm template diy | bat -l yaml --style=plain # display rendered yaml manifests | |||
kubectl create ns diy | |||
helm install ./diy --generate-name -n diy # Generated name | |||
# ____NAME______ | |||
# podName : pod/diy-1587926286-866d97bb75-vskns | |||
# serviceName : service/diy-1587926286 | |||
# deploymentName: deployment.extensions/diy-1587926286 | |||
# NAME TYPE | |||
# secret/sh.helm.release.v1.diy-1587926286.v1 helm.sh/release.v1 | |||
helm install foo ./diy -n diy # Custom name | |||
# _NAME__ | |||
# podName : pod/foo-diy-6fd79d9bbd-nh5hl | |||
# serviceName : service/foo-diy | |||
# deploymentName: deployment.extensions/foo-diy | |||
# NAME TYPE | |||
# secret/sh.helm.release.v1.foo.v1 helm.sh/release.v1 | |||
helm list -n diy | |||
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION | |||
diy-1587926286 diy 1 2020-04-26 19:38... deployed diy-0.1.0 1.16.0 | |||
foo diy 1 2020-04-26 20:02... deployed diy-0.1.0 1.16.0 | |||
</source> | |||
= Resources = | = Resources = | ||
* [https://helm.sh/docs/intro/using_helm/ Using Helm Guide] | * [https://helm.sh/docs/intro/using_helm/ Using Helm Guide] |
Revision as of 21:56, 26 April 2020
Install
LATEST=$(curl --silent "https://api.github.com/repos/helm/helm/releases/latest" | jq -r .tag_name) curl -LO https://get.helm.sh/helm-${LATEST}-linux-amd64.tar.gz tar xzvf helm-${LATEST}-linux-amd64.tar.gz sudo install linux-amd64/helm /usr/local/bin/helm
Operations
helm repo add stable https://kubernetes-charts.storage.googleapis.com/ helm repo update # Make sure we get the latest list of charts helm search repo stable/jenkins # Helm3 bug:does not respect '--namespace' flag, so set default namespace kubectl create ns jenkins kubectl config set-context $(kubectl config current-context) --namespace=jenkins helm install [NAME] [CHART] [flags] helm install jenkins-ci stable/jenkins # release name: jenkins-ci helm install stable/mysql --generate-name # release name will be generated helm ls # show a list of all deployed releases NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION jenkins-ci jenkins 1 2020-04-25 15:.. deployed jenkins-1.17.2 lts
- Jenkins chart post install instructions
NAME: jenkins-ci LAST DEPLOYED: Sat Apr 25 15:33:36 2020 NAMESPACE: jenkins STATUS: deployed REVISION: 1 NOTES: 1. Get your 'admin' user password by running: printf $(kubectl get secret --namespace jenkins jenkins-ci -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo 2. Get the Jenkins URL to visit by running these commands in the same shell: export POD_NAME=$(kubectl get pods --namespace jenkins -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=jenkins-ci" -o jsonpath="{.items[0].metadata.name}") echo http://127.0.0.1:8080 kubectl --namespace jenkins port-forward $POD_NAME 8080:8080 3. Login with the password from step 1 and the username: admin For more information on running Jenkins on Kubernetes, visit: https://cloud.google.com/solutions/jenkins-on-container-engine
Create a chart
helm version --short # -> v3.1.3+g0a9a9a8 helm create diy # diy = [NAME] $> tree 1chart 1chart ├── charts ├── Chart.yaml ├── templates │ ├── deployment.yaml │ ├── _helpers.tpl │ ├── ingress.yaml │ ├── NOTES.txt │ ├── serviceaccount.yaml │ ├── service.yaml │ └── tests │ └── test-connection.yaml └── values.yaml helm template diy | bat -l yaml --style=plain # display rendered yaml manifests kubectl create ns diy helm install ./diy --generate-name -n diy # Generated name # ____NAME______ # podName : pod/diy-1587926286-866d97bb75-vskns # serviceName : service/diy-1587926286 # deploymentName: deployment.extensions/diy-1587926286 # NAME TYPE # secret/sh.helm.release.v1.diy-1587926286.v1 helm.sh/release.v1 helm install foo ./diy -n diy # Custom name # _NAME__ # podName : pod/foo-diy-6fd79d9bbd-nh5hl # serviceName : service/foo-diy # deploymentName: deployment.extensions/foo-diy # NAME TYPE # secret/sh.helm.release.v1.foo.v1 helm.sh/release.v1 helm list -n diy NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION diy-1587926286 diy 1 2020-04-26 19:38... deployed diy-0.1.0 1.16.0 foo diy 1 2020-04-26 20:02... deployed diy-0.1.0 1.16.0