Cloud Native Development
Cloud code for example
20.07.2020 Nelson
Agenda
Cloud-native & kubernetes
Why do we develop on kubernetes?
Difficulty and solution
Cloud code and related components
About
Nelson Lin
Cloud Technical Account Manager
in Red Hat. Help accounts adopt Red
Hat cloud technologies well and help
them succeed.
Software engineer, building a cloud
management system, experienced of
frontend and backend programming
having experience in CI/CD pipeline,
interested in big data, distributed
computing, and cloud-native
technologies.
Cloud Native & Kuberenetes
Cloud-native definition
● An approach exploits the advantages of the cloud
computing delivery model to building and running
applications
● How applications are created and deployed,
● Cloud native is all about changing the way you think
about constructing critical business systems.
● Cloud-native systems are designed to embrace rapid
change, large scale, and resilience.
https://tanzu.vmware.com/cloud-native
https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition
https://zh.data-driven.blog/2019/11/01/%E4%BB%80%E9%BA%BC%E6%98%AF-cloud-native%EF%BC%9F-%E7%82%BA%E4%BB%80%E9%BA%BC-cloud-native-
%E9%80%99%E9%BA%BC%E7%86%B1%E9%96%80%EF%BC%9F/
Cloud-native foundational pillars
While several container orchestrators
exist, Kubernetes has become the
de facto standard for the cloud-native
world. It's a portable, extensible, open-
source platform for managing
containerized workloads.
Why Do We Develop On Kubernetes
DevOps deployment pipeline
https://www.quartech.com/technologies/devops/
Let’s go dive deeper
Let’s go dive deeper
Development phase takes over 65%of your SDLC
Containerization/Cloud-nativeVirtualization(XaaS)
From convention to virtualization and cloud-native
Single-box
Difficulty And Solution
Developing k8s/cloud-native app. is frustrating
Too much
configuration
Debugging is a
pain
Applications have
so many moving
parts
Spend too much
time outside of the
codes
Infinite loop of pain &
suffering
Even “Hello, World” is complicated!
Error prone
People solve that with bash scripts,
makefiles and ansible
1
4
2
53
6
Change
code
Run docker
build
Run docker
push
Patch yaml
Run kubectl
apply
Verify
7
debugging
Challenge
Config Chaos
Slow & Error-prone
Repetitive tasks
Hard to debug
Logging way
Here Comes Cloud Code
Cloud Code
Set of development tools
Cloud Code
IDE Skaffold JIB
Cloud Code
● support for the full
development cycle of
Kubernetes applications
● create a cluster for
development
● test running your finished
application
● Build & deploy
● Tag & Test & cleanup
● File sync
● Log tailing
● Port forwarding
https://cloud.google.com/code/docs/vscode/quickstart
https://cloud.google.com/code/docs/intellij/quickstart-IDEA
Out-of-the-box configuration snippets, tailored debugging experience
Making developing with Kubernetes a whole lot easier
Jib is a set of plugins for maven and gradle for
building optimized OCI-compliant container
images for Java applications without a
Docker daemon.
JIB
● Fast
○ separates applications into multiple
layers
○ splitting dependencies from classes
● Daemon-less
○ No need of docker CLI or
counterparts
○ No dockerfile
● Reproducible
https://github.com/GoogleContainerTools/jib/issues/101
https://github.com/GoogleContainerTools/jib
The flow difference
Docker build flow
JIB build flow
JIB makes build images and transfer them efficiently
200MB 2MB
Enhanced by 10,000%
Skaffold
Skaffold as a Kubernetes-native framework for developer workflows, portable to
any IDE or CI system. It provides a very easy way to test local changes to your
app on a Kubernetes cluster. And it supports multiple image builders (local
Docker, GCB & Kaniko).
Build
● Dockerfile
● Bazel
● Jib
● buildpack
That’s Skaffold
Adapts to your tooling local +
remote clusters
Test
● container-
structure-
test
Tag
● Git
● Sha256
● Env Template
● DateTime
Deploy
● Kubectl
● Helm
● kustomize
Architecture with pluggability
Skaffold debugger
● Built artifacts determine the underlying runtime technologies
● Artifacts transformed on-the-fly runtime’s debugger functionality
● Supported Language
○ Go
○ NodeJS
○ Java & JVM Language
○ Python
● Runtime specific images
○ .net Core
https://skaffold.dev/docs/workflows/debug/
Skaffold pipeline stages
Skaffold Pipeline stages Description
Init generate a starting point for Skaffold configuration
Build build images with different builders
Tag tag images based on different policies
Test test images with structure tests
Deploy deploy with kubectl, kustomize or helm
File Sync sync changed files directly to containers
Log Tailing tail logs from workloads
Port Forwarding forward ports from services and arbitrary resources to
localhost
Cleanup cleanup manifests and images
https://skaffold.dev/docs/references/yaml/
After developing, GitOps plays the next stage.
Cloud Code for IDE plugins
Step 1
Getting Started
Step 2
Local Development
Step 3
Deploy to remote
cluster
Step 4
Troubleshooting
Debugging & logs
Private image
registry
https://kubernetes.io/docs/tasks/configure-pod-container/pull-
image-private-registry/
Then
#kubectl create secret docker-registry 
--docker-server=<uri> 
--docker-username=<id> 
--docker-password=<password> 
<name>
pod/dc/deployment/ defines spec.
spec.imagePullSecrets.name = <prior to name>
Workflow of cloud code
ui(nodejs)
title(java)
game(go)
Laptop Remote Cluster
ui:v1
title:v1
game:v1
watch & sync
watch & mvn jibBuild
watch & docker build
port-forwarding
http://localhost:8080
Let’s Demo
Demo introduction
nodejs-backend
nodejs-frontend
nodejs-backend
nodejs-frontend
monogo
svc/mongo
svc/frontend
svc/backend
backend
frontend
monogo
svc/mongo
svc/frontend
svc/backend
backend
frontend
secret/quay
secret/quay
docker-desktop
OCP
Port-forward & log
Port-forward & log
deploy
deploy
push
push
RemoteLocal
intellij
vscode
Show my screen
Problem
No enough resources
No managed services
Changing IDE is arduous
Have to learn new skills
Support few tools
How integrate with you existing
circumstances/pipelines.
Take away
Let your code deployed on
kubernetes as early as possible if
you want to run on K8S
Cloud code is just a tool, but follow
the concept and try to develop as
cloud-native way ( odo, crc, ocp
and acm)
Try to reduce the gap between
deployment engineer and software
engineer
With advent of k8s, go learn a new
skill - k8s
Thank you and question?

[20200720]cloud native develoment - Nelson Lin

  • 1.
    Cloud Native Development Cloudcode for example 20.07.2020 Nelson
  • 2.
    Agenda Cloud-native & kubernetes Whydo we develop on kubernetes? Difficulty and solution Cloud code and related components
  • 3.
    About Nelson Lin Cloud TechnicalAccount Manager in Red Hat. Help accounts adopt Red Hat cloud technologies well and help them succeed. Software engineer, building a cloud management system, experienced of frontend and backend programming having experience in CI/CD pipeline, interested in big data, distributed computing, and cloud-native technologies.
  • 4.
    Cloud Native &Kuberenetes
  • 5.
    Cloud-native definition ● Anapproach exploits the advantages of the cloud computing delivery model to building and running applications ● How applications are created and deployed, ● Cloud native is all about changing the way you think about constructing critical business systems. ● Cloud-native systems are designed to embrace rapid change, large scale, and resilience. https://tanzu.vmware.com/cloud-native https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition https://zh.data-driven.blog/2019/11/01/%E4%BB%80%E9%BA%BC%E6%98%AF-cloud-native%EF%BC%9F-%E7%82%BA%E4%BB%80%E9%BA%BC-cloud-native- %E9%80%99%E9%BA%BC%E7%86%B1%E9%96%80%EF%BC%9F/
  • 6.
    Cloud-native foundational pillars Whileseveral container orchestrators exist, Kubernetes has become the de facto standard for the cloud-native world. It's a portable, extensible, open- source platform for managing containerized workloads.
  • 7.
    Why Do WeDevelop On Kubernetes
  • 8.
  • 9.
  • 10.
    Let’s go divedeeper Development phase takes over 65%of your SDLC
  • 11.
  • 12.
  • 13.
    Developing k8s/cloud-native app.is frustrating Too much configuration Debugging is a pain Applications have so many moving parts Spend too much time outside of the codes
  • 14.
    Infinite loop ofpain & suffering Even “Hello, World” is complicated! Error prone People solve that with bash scripts, makefiles and ansible 1 4 2 53 6 Change code Run docker build Run docker push Patch yaml Run kubectl apply Verify 7 debugging
  • 15.
    Challenge Config Chaos Slow &Error-prone Repetitive tasks Hard to debug Logging way
  • 16.
  • 17.
    Cloud Code Set ofdevelopment tools
  • 18.
    Cloud Code IDE SkaffoldJIB Cloud Code ● support for the full development cycle of Kubernetes applications ● create a cluster for development ● test running your finished application ● Build & deploy ● Tag & Test & cleanup ● File sync ● Log tailing ● Port forwarding https://cloud.google.com/code/docs/vscode/quickstart https://cloud.google.com/code/docs/intellij/quickstart-IDEA Out-of-the-box configuration snippets, tailored debugging experience Making developing with Kubernetes a whole lot easier
  • 19.
    Jib is aset of plugins for maven and gradle for building optimized OCI-compliant container images for Java applications without a Docker daemon. JIB ● Fast ○ separates applications into multiple layers ○ splitting dependencies from classes ● Daemon-less ○ No need of docker CLI or counterparts ○ No dockerfile ● Reproducible https://github.com/GoogleContainerTools/jib/issues/101 https://github.com/GoogleContainerTools/jib
  • 20.
    The flow difference Dockerbuild flow JIB build flow
  • 21.
    JIB makes buildimages and transfer them efficiently 200MB 2MB Enhanced by 10,000%
  • 22.
    Skaffold Skaffold as aKubernetes-native framework for developer workflows, portable to any IDE or CI system. It provides a very easy way to test local changes to your app on a Kubernetes cluster. And it supports multiple image builders (local Docker, GCB & Kaniko).
  • 23.
    Build ● Dockerfile ● Bazel ●Jib ● buildpack That’s Skaffold Adapts to your tooling local + remote clusters Test ● container- structure- test Tag ● Git ● Sha256 ● Env Template ● DateTime Deploy ● Kubectl ● Helm ● kustomize
  • 24.
  • 25.
    Skaffold debugger ● Builtartifacts determine the underlying runtime technologies ● Artifacts transformed on-the-fly runtime’s debugger functionality ● Supported Language ○ Go ○ NodeJS ○ Java & JVM Language ○ Python ● Runtime specific images ○ .net Core https://skaffold.dev/docs/workflows/debug/
  • 26.
    Skaffold pipeline stages SkaffoldPipeline stages Description Init generate a starting point for Skaffold configuration Build build images with different builders Tag tag images based on different policies Test test images with structure tests Deploy deploy with kubectl, kustomize or helm File Sync sync changed files directly to containers Log Tailing tail logs from workloads Port Forwarding forward ports from services and arbitrary resources to localhost Cleanup cleanup manifests and images https://skaffold.dev/docs/references/yaml/
  • 27.
    After developing, GitOpsplays the next stage.
  • 28.
    Cloud Code forIDE plugins Step 1 Getting Started Step 2 Local Development Step 3 Deploy to remote cluster Step 4 Troubleshooting Debugging & logs
  • 29.
    Private image registry https://kubernetes.io/docs/tasks/configure-pod-container/pull- image-private-registry/ Then #kubectl createsecret docker-registry --docker-server=<uri> --docker-username=<id> --docker-password=<password> <name> pod/dc/deployment/ defines spec. spec.imagePullSecrets.name = <prior to name>
  • 30.
    Workflow of cloudcode ui(nodejs) title(java) game(go) Laptop Remote Cluster ui:v1 title:v1 game:v1 watch & sync watch & mvn jibBuild watch & docker build port-forwarding http://localhost:8080
  • 31.
  • 32.
  • 33.
  • 34.
    Problem No enough resources Nomanaged services Changing IDE is arduous Have to learn new skills Support few tools How integrate with you existing circumstances/pipelines.
  • 35.
    Take away Let yourcode deployed on kubernetes as early as possible if you want to run on K8S Cloud code is just a tool, but follow the concept and try to develop as cloud-native way ( odo, crc, ocp and acm) Try to reduce the gap between deployment engineer and software engineer With advent of k8s, go learn a new skill - k8s
  • 36.
    Thank you andquestion?

Editor's Notes

  • #16 Repetitive tasks of building, pushing and deploying images Difficult to set up debugging against a k8s