https://www.youtube.com/watch?v=-GsvomI4CCQ very pragmatic Simplilearn tutorial,
you can practice on https://www.katacoda.com/courses/jenkins/build-docker-images which gives you a dockerized Jenkins with console
Awesome power-jenkins tip-pack https://www.youtube.com/watch?v=6BIry0cepz4 :
- run Jenkins in Docker (jenkins/jenkins)
- select plugins you want to use (use plugins.txt to predefine a list of plugins)
- use agents, with swarm plugin to register, automate the agent provisioning and make them ephemeral
- don't use Maven jobs, because it's not reproduceable
- use pipelines, with Jenkinsfile (pipeline/stages/stage/steps)
- in pipelines, do all work on agents ("agent any")
- user input stage should be run on master, to avoid blocking executors ("agent none")
- limit number of stages
- don't change $env variable, use withEnv(["hello=world"]) instead
- parameters (?)
- use parallelism, for end to end tests , and performance tests and in separate nodes
- "scripted" is groovish for power user, declarative is ok for regular user
- pipelines should be small, they are orchestration tools... do the heavy stuff fin shell scripts which are easier to test
- in a pipeline everything is serializable so it can be resumed on failure (continuation-passing style)... but some classes are not serializable like groovy.text.StreamingTemplateEngine, then you have to wrap it
- BlueOcean plugin, with Editor for declarative pipelines
- use shared libraries in pipelines to reuse code, also reuse files
- use views to show only the jobs you are interested in
- BuildMonitor plugin to view jobs
- API in JSON or XML
- to-have plugins: BuildMonitor, Job Config History (to version freestyle jobs), Job DSL, Throttle Concurrent Builds, Timestamper, Version Number plugin & Build-name-setter
Wednesday, August 28, 2019
Kubernetes academy
https://kubernetes.academy/lessons/introduction-to-kubectl awesome productivity tips from John Harris
source < (kubectl completion bash)
kubectx
kubens
kube-ps1 + kubeon
#doc on a k8s object
kubectl explain pod.spec.containers.ports
#grep json
kubectl get pod -n kube-system kube-scheduler-master -ojson | jq .metadata.labels
#show custom columns
kubectl get pod -n kube-system kube-scheduler-master -o custom-columns=NAME:.metadata.name,NS:.metadata.namespace
#show labels
kubectl get pod -n kube-system --show-labels
#show column with value of given label
kubectl get pod -n kube-system -L k8s-app
#filter by label value
kubectl get pod -n kube-system -l k8s-app=kube-dns -L k8s-app
#sort by
get pod -n kube-system -l k8s-app=kube-dns --sort-by='{.status.containerStatuses[*].restartCount}'
#trace execution (very verbose)
get pod -n kube-system -l k8s-app=kube-dns --sort-by='{.status.containerStatuses[*].restartCount}' -v10
https://kubernetes.academy/lessons/introduction-to-ingress
Labels:
kubernetes
Monday, August 19, 2019
Subscribe to:
Posts (Atom)