Skip to content

Jenkins X - Kubernetes Days

Prepare

asciinema rec first.cast
asciinema play -i 2 first.cast
  • -i -> play back with max of 2 seconds of idleness
  • -s -> play back with double speed

Process

  • Create cluster
  • Create quickstart
  • Gitops
  • Promotion
  • Pr
  • jx boot

Commands

asciinema rec jx-k8s-days-00-logo.cast
  ______  __        ______    __    __   _______        .__   __.      ___   .___________. __  ____    ____  _______                     
 /      ||  |      /  __  \  |  |  |  | |       \       |  \ |  |     /   \  |           ||  | \   \  /   / |   ____|                    
|  ,----'|  |     |  |  |  | |  |  |  | |  .--.  |______|   \|  |    /  ^  \ `---|  |----`|  |  \   \/   /  |  |__                       
|  |     |  |     |  |  |  | |  |  |  | |  |  |  |______|  . `  |   /  /_\  \    |  |     |  |   \      /   |   __|                      
|  `----.|  `----.|  `--'  | |  `--'  | |  '--'  |      |  |\   |  /  _____  \   |  |     |  |    \    /    |  |____                     
 \______||_______| \______/   \______/  |_______/       |__| \__| /__/     \__\  |__|     |__|     \__/     |_______|                    

                                      ______  __       ___ ______  _______                                                               
                                     /      ||  |     /  //      ||       \                                                              
                                    |  ,----'|  |    /  /|  ,----'|  .--.  |                                                             
                                    |  |     |  |   /  / |  |     |  |  |  |                                                             
                                    |  `----.|  |  /  /  |  `----.|  '--'  |                                                             
                                     \______||__| /__/    \______||_______/                                                              

____    __    ____  __  .___________. __    __               __   _______ .__   __.  __  ___  __  .__   __.      _______.      ___   ___ 
\   \  /  \  /   / |  | |           ||  |  |  |             |  | |   ____||  \ |  | |  |/  / |  | |  \ |  |     /       |      \  \ /  / 
 \   \/    \/   /  |  | `---|  |----`|  |__|  |             |  | |  |__   |   \|  | |  '  /  |  | |   \|  |    |   (----`       \  V  /  
  \            /   |  |     |  |     |   __   |       .--.  |  | |   __|  |  . `  | |    <   |  | |  . `  |     \   \            >   <   
   \    /\    /    |  |     |  |     |  |  |  |       |  `--'  | |  |____ |  |\   | |  .  \  |  | |  |\   | .----)   |          /  .  \  
    \__/  \__/     |__|     |__|     |__|  |__|        \______/  |_______||__| \__| |__|\__\ |__| |__| \__| |_______/          /__/ \__\ 
asciinema play jx-k8s-days-00-logo.cast

Create Cluster

export NAMESPACE=cd
export PROJECT=
asciinema rec jx-k8s-days-01-create.cast
jx create cluster gke -n jx-rocks -p $PROJECT -r us-east1 \
    -m n1-standard-4 --min-num-nodes 1 --max-num-nodes 2 \
    --default-admin-password=admin \
    --default-environment-prefix jx-rocks --git-provider-kind github \
    --namespace $NAMESPACE --prow --tekton
asciinema play -i 1 -s 4 jx-k8s-days-01-create.cast

Create QuickStart Go

asciinema rec jx-k8s-days-02-quickstart.cast
export APP_NAME=jx-k8s-days-go-02
jx create quickstart --filter golang-http --project-name ${APP_NAME} --batch-mode
ls -l ${APP_NAME}
jx get activity -f ${APP_NAME} -w
jx get pipelines
jx get applications -e staging
http "http://${APP_NAME}.cd-staging.35.185.41.106.nip.io"
jx get build logs -f ${APP_NAME}  # Cancel with ctrl+c
cd ${APP_NAME}
vim main.go
jx get activity -f ${APP_NAME} -w
jx get applications -e staging
http "http://${APP_NAME}.cd-staging.35.185.41.106.nip.io"
asciinema play -i 2 -s 2 jx-k8s-days-02-quickstart.cast

Import Project

 __  .___  ___. .______     ______   .______     .___________.    __________   ___  __       _______.___________..__   __.   _______ 
|  | |   \/   | |   _  \   /  __  \  |   _  \    |           |   |   ____\  \ /  / |  |     /       |           ||  \ |  |  /  _____|
|  | |  \  /  | |  |_)  | |  |  |  | |  |_)  |   `---|  |----`   |  |__   \  V  /  |  |    |   (----`---|  |----`|   \|  | |  |  __  
|  | |  |\/|  | |   ___/  |  |  |  | |      /        |  |        |   __|   >   <   |  |     \   \       |  |     |  . `  | |  | |_ | 
|  | |  |  |  | |  |      |  `--'  | |  |\  \----.   |  |        |  |____ /  .  \  |  | .----)   |      |  |     |  |\   | |  |__| | 
|__| |__|  |__| | _|       \______/  | _| `._____|   |__|        |_______/__/ \__\ |__| |_______/       |__|     |__| \__|  \______| 

     ___      .______   .______    __       __    ______     ___   .___________. __    ______   .__   __.                            
    /   \     |   _  \  |   _  \  |  |     |  |  /      |   /   \  |           ||  |  /  __  \  |  \ |  |                            
   /  ^  \    |  |_)  | |  |_)  | |  |     |  | |  ,----'  /  ^  \ `---|  |----`|  | |  |  |  | |   \|  |                            
  /  /_\  \   |   ___/  |   ___/  |  |     |  | |  |      /  /_\  \    |  |     |  | |  |  |  | |  . `  |                            
 /  _____  \  |  |      |  |      |  `----.|  | |  `----./  _____  \   |  |     |  | |  `--'  | |  |\   |                            
/__/     \__\ | _|      | _|      |_______||__|  \______/__/     \__\  |__|     |__|  \______/  |__| \__|                            
asciinema rec jx-k8s-days-03-import.cast
git clone https://github.com/joostvdg/go-demo-6.git
cd go-demo-6
git checkout orig
git merge -s ours master --no-edit
git checkout master
git merge orig
rm -rf charts
ls -lath
git push

jx import --batch-mode
jx get activities --filter go-demo-6 --watch
jx get applications
kubectl --namespace cd-staging logs -l app=jx-go-demo-6
echo "dependencies:
- name: mongodb
  alias: go-demo-6-db
  version: 5.3.0
  repository:  https://kubernetes-charts.storage.googleapis.com
  condition: db.enabled" > charts/go-demo-6/requirements.yaml
cat charts/go-demo-6/requirements.yaml
vim charts/go-demo-6/templates/deployment.yaml
        env:
        - name: DB
          value: {{ template "fullname" . }}-db
vim charts/go-demo-6/values.yaml
probePath: /demo/hello?health=true
git status
git add charts/
git commit -m "add db dependency"
git push
jx get activities --filter go-demo-6 --watch
jx get applications
http http://go-demo-6.cd-staging.35.185.41.106.nip.io/demo/hello
jx delete application
rm -rf go-demo-6
jx get applications
asciinema play -i 2 -s 2 jx-k8s-days-03-import.cast

Preview Environments

APP_NAME=jx-k8s-days-go-01
asciinema rec jx-k8s-days-04-preview.cast
jx get applications
cd ${APP_NAME}
git checkout -b my-new-pr-3
vim main.go
git status
git add main.go
git commit -m "change message"
git push --set-upstream origin my-new-pr-3
jx create pullrequest \
    --title "My PR" \
    --body "This is the text that describes the PR" \
    --batch-mode
open pr link
jx get previews
http ..
add /lgtm to pr
merge pr
jx get activity --filter jx-k8s-day-go-01 --watch
jx get applications
git checkout master
git pull
cd ..
jx get previews
jx gc previews
jx get previews
asciinema play -i 2 -s 2 jx-k8s-days-04-preview.cast

Env

jx create environment

Reel

for VARIABLE in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
do
    asciinema play jx-k8s-days-00-logo.cast
    asciinema play -i 2 -s 3 jx-k8s-days-01-create.cast
    asciinema play -i 2 -s 1 jx-k8s-days-02-quickstart.cast
    asciinema play -i 2 -s 1 jx-k8s-days-03-import.cast
    asciinema play -i 2 -s 2 jx-k8s-days-04-preview.cast
done

Last update: 2019-09-21 22:02:04