basic intro to cloud foundry - image relay
TRANSCRIPT
1
Basic Intro To Cloud Foundry
Session ID: HOL-1113
Hands-On: Technical Beginner
SUSECON 2020
Louis Paul – SUSE Technical Architect
2
Who The Heck Is This Guy?
Dwain Sims
SUSE Sales Engineer
Dwain is a Sales Engineer at SUSE working with customers on Software Defined
Everything. He has a Master’s Degree in Computer Science and more than 30
years’ experience in working for companies such as Lockheed, Sun
Microsystems, SteelEye Technology, Fusion-io and SanDisk. He is a frequent
speaker at Linux User’s Group meetings, the SouthEast Linux Fest, SUSECon,
and other events.
3
Louis Paul
SUSE Cloud Architect
As a Cloud Solution Architect at SUSE, Louis responsibility lies on focusing on Cloud Native
Platforms and Application delivery. He worked with Enterprise systems and Development
platforms in the Financial/Wall Street arena for over 2 decades. He joined the HPE Cloud
team in 2016 working on Helion Stackato before its transition to SUSE to pursue
development of SUSE Application delivery solutions.
4
Attribution
Engineer Better
https://www.engineerbetter.com/
The team at Engineer Better were the original creators of this tutorial, found
on the cf.org website.
5
Agenda
1. Intro to Cloud Foundry and SUSE Cloud Application
Platform
2. Hands on Labs 1-4
3. Cloud Foundry in your organization
4. Extra Credit Lab 5
5. Info and Training and "other" session links
6
Why Do They Call This Thing Cloud Foundry?
Because I am a factory / foundry of Cloud Native applications... raw materials (code) go in... products(web apps) come out
7
7
The Dev's
The Op's
8
What Is Cloud Foundry?
Cloud Foundry is an open source cloud platform as a service (PaaS) on
which developers can build, deploy, run and scale applications.
Key Benefit:
Enterprise development groups that use PaaS solutions like Cloud Foundry don’t have
to worry about the details of how to manage cloud resources to run their apps. The
platform takes care of that for them. All "The Dev's" must focus on is their application
code and access to a catalog of services. The platform does the rest: scaling, healing,
high availability, disaster recovery, and so on.
9
10
CAP Terminology
Control Plane – Plumbing - Infrastructure (nodes) needed to operate the software
solution. As in "containerized control plane"
Containers – portable application run units
Kubernetes – Operations Management of Containers
Stratos – Graphical User Interface for CAP and Kubernetes
Cloud Foundry Buildpacks – Universal language translator. Allow for DEV's code
to be published to CF; supports many languages, Buildpacks create a runnable
artifact called a droplet
11
What Is SUSE CAP Platform?
SUSE Cloud Application Platform is a modern application delivery platform
WITH A MODERN INFRASTRUCTURE FRAMEWORK used by software
development and operations teams to streamline lifecycle management of
traditional and new cloud native applications. Bringing together industry
leading Cloud Foundry and Kubernetes technologies, the platform facilitates
DevOps process integration to accelerate innovation, improve IT
responsiveness, and maximize return on investment.
SUSE Cloud Application Platform increases business agility by helping your
software development and operations teams.
https://www.suse.com/products/cloud-application-platform/
Key Difference from other CF vendors: CAP is completely containerized
control plane and we do not use BOSH.
12
SUSE Cloud Foundry (containerized)
SUSE CaaS Platform 4.1
Kubernetes 1.16
SUSE Cloud Application Platform
Containerized Cloud Foundry, Built on SUSE Linux Enterprise
SUSE Cloud Application PlatformBYO
Containers
Control plane: SUSE Linux Enterprise containers
Application execution: SUSE Linux Enterprise containers
Broker UAA Volume Router CC API Logging
SLE
SLE SLE SLE SLE SLE SLE
SLE SLE SLE SLE SLE
Workloads Workloads Workloads Workloads WorkloadsWorkloads
Public Cloud
Amazon, Google, Microsoft
Bare Metal
SLES supported hardware
Virtual Machines
KVM, Xen, VMware, Microsoft
Private Cloud
SUSE OpenStack Cloud
Public Cloud K8s-as-a-Service
EKS, AKS (GKE, AliCloud)
13
Legacy Cloud Foundry vs. CAP
• Aged Software Infrastructure Control Plane and
Operational Framework
- VM's, Bosch, Diego
• X-Large Installation Footprint minimum – 12-27
nodes
Cloud Foundry • Modern Software Infrastructure
- Containers, K8's
• Installs into container infra
• Cloud Agnostic
• Container Platform Agnostic
• Run in Cloud or On-Prem
• Small Installation Footprint – 7 nodes
• NO Vendor Lock IN OPEN OPEN
• 100% open source
• Stratos UI allows for multi CF instance and
Kubernetes management
SUSE CAP
13
14
Reuse your existing Kubernetes cluster
Eirini is a new feature of Cloud Foundry Foundation that enables pluggable scheduling for
the Cloud Foundry Application Runtime. Specifically, Eirini allows operators to choose
whether Cloud Foundry Application Runtime should use Diego (the default scheduler in
CFAR) or Kubernetes to orchestrate application container instances. The project’s goal is
to provide the option of reusing an existing Kubernetes cluster infrastructure to host
applications deployed by CFAR.
NOTE: Eirini is a tech preview feature in SUSE Cloud Application Platform 1.5.1
15
Lab #1 & #2
Interacting With
Cloud Foundry
Via The CLI
16
Lab Machine Environment
We will be using a virtual environment under KVM
• The virtual machine is called cflab, and the system is in disk01.qcow2
• Go full screen
CF CLI has been pre-installed
Presentation, cheat sheet, are on lab desktop
Lab files that we will be using for this hands-on session are here
Use FireFox for web browsing (good bookmarks are set)
Left side Right side
17
The CF Sign Up And Target Environment
1) anynines public PaaS
Sign up by going to https://paas.anynines.com/
2) Login to anynines, select 3 for test space
3) Are you logged into anynines public
PaaS?
4) What org and space are you targeting?
Tasks Cheat Sheet
1) Goto anynines web site. There is a step by
step pdf located (here)
2) Register (No Credit Card Needed)
3) Open terminal to Login from CLI:
cf login https://api.de.a9s.eu (enter)
Email> Enter email used to register with
anynines (enter)
Password> Enter anynines password (enter)
4) You can see where you are logged in using cftarget. You should see something similar to:
18
Login Process.....
20
Lab #3
Pushing Your
First Cloud
Foundry App
21
Getting Help with cf Command Line
Getting help with the "cf"
command line:
cf help –a
cf <some cmd> --help
Use the cf command line cheat
sheet you were given.
TASKS
• Open terminal
• cf help -a
• cf <some cmd> --help
• cf push --help
• cf target –help
• cf help –a | grep push
Cheat Sheet
22
Pushing Your First App (part 1)
Look at your cf environment to make
sure you are logged in correctly.
Change directory to the 03-push/web-
app
What files are in this directory?
Push the app: cf push
Check to see if the app is running
correctly.
TASKS
• Open terminal
• cf target
• cd training-zero-to-hero/03-
push/web-app
• ls
• cf push
• Look for "running" under state.
• cf app web-app
Cheat Sheet
23
Pushing Your First App (part 2)
Access Your App. Find the Random
URL in the output of the push.
Use the random URL in your browser
Find out more details about your
running app
Find out more about "Random
Routes"
TASKS
• Look for URL next to "routes:" from the
output of the "cf push"
• Cut/Paste this URL into the FF browser.
• cf app web-app
• cf push --help
Cheat Sheet
24
Pushing Your First App (part 3)
Push the Worker App
Is there a "routes:" or URL
associated with this app?
Check the recent log entries
being produced by this app.
TASKS
• cd training-zero-to-hero/03-
push/worker-app
• cf push
• Look for "running" under state, in
the cf push commands output.
• cf app worker-app
• cf logs worker-app --recent
Cheat Sheet
25
Pushing Your First App (part 4)
Delete both apps to cleanup your
space.
Make sure no apps are running.
TASKS
• cf delete web-app
• cf delete worker-app
• cf apps (should show "No apps
found")
Cheat Sheet
26
Lab #4
We will examine a running
app to understand what a
buildpack provides
Buildpacks - create a
runnable artifact called
a droplet
27
Buildpacks (part 1)
Look at the system buildpacks that
are available on this Cloud Foundry
installation.
Push the "static-app" found in 04-
buildpacks
Check to see if the app is running
correctly.
What buildpack is "static-app" using?
TASKS
• cf buildpacks (you should see 18 or so)
• cd training-zero-to-hero/04-
buildpacks/static-app
• cf push
• Look for "running" under state.
• cf app static-app
• Look for "buildpacks:" in cf push output
or cf app static-app
Cheat Sheet
28
Buildpacks (part 2)
Log into the running "static-app" and do
some inspection.
What kernel is the app running?
What processes are running in the app?
What files did the buildpack provide?
Exit out of the static-app
Scale "static-app" so that 4 instances are
running.
Look at static-app instances
TASKS
• cf ssh static-app
• $ uname -a
• $ ps –eaf ---or---
• $ top
• $ ls /app
• $ exit or ctrl-D
• cf scale static-app -i 4
• cf app static-app
Cheat Sheet
29
Buildpacks (part 2.1)
Delete static-app or reduce
instance count to 1
Validate what apps are running
(delete any that are running)
TASKS
• cf scale static-app -i 1
• cf delete static-app
• cf apps
• cf delete [app-name]
Cheat Sheet
30
Buildpacks (part 3)
More with buildpacks; cd to the 04-
buildpacks/mixed-app directory and see it contains
both index.html and index.php.
Push the app.
Which buildpack is deployed?
Visit both URL/index.html and URL/index.php
Use "cf ssh" to see what files the buildpack added.
Exit ssh session when done.
View mixed-app recent logs
• cd training-zero-to-hero/04-buildpacks/mixed-app
• ls
• cf push
• Look for "buildpacks:" in cf push commands output
• Look for URL next to "routes:"
• Cut/Paste this URL into the browser with both index.php
and index.html on the end.
• cf ssh mixed-app
• $ ls /app
• $ exit or ctrl-D
• cf logs mixed-app --recent
Cheat SheetTASKS
31
Buildpacks (part 4)
Override the Buildpack
Push the app again, but this time override the
buildpack with this
one: https://github.com/cloudfoundry/staticfile-buildpack
Notice what buildpack was used as the app gets
pushed.
Visit both URL/index.htlm and URL/index.php
Use "cf ssh" to see what the buildpack added.
TASKS • cd training-zero-to-hero/04-buildpacks/mixed-
app
• cf push -b
https://github.com/cloudfoundry/staticfile-
buildpack
• Look for URL next to "routes:"
• Cut/Paste this URL into the browser with both
index.php and index.html on the end.
• cf ssh mixed-app
• $ ls /app
• $ exit or ctrl-D
Cheat Sheet
32
Buildpacks (part 5)
Delete both apps to cleanup your
space. Check and make sure no
apps are running.
TASKS
• cf delete static-app
• cf delete mixed-app
• cf apps (should show "No apps
found")
Cheat Sheet
33
Lab #5
Resilience And Availability -
We will use purposefully
crashed app instances and
see how Cloud Foundry
works to maintain availability
34
Making Apps Resilient (part 1)
Change Directory to the 05-
resilience/imperfect-app
Push the "imperfect app"
Use the random URL in your browser
Click "Crash me" on the page.
Check the status of your app
Can you see the app in the crashed state?
TASKS
• cd training-zero-to-hero/05-resilience/imperfect-app
• cf push
• Look for URL next to "routes:"
• Cut/Paste this URL into the browser.
• Click the "Crash me" link.
• Back in the terminal, issue "cf app imperfect-app"
to check the status.
• Even catching "starting" is good.
Cheat Sheet
35
Making Apps Resilient (part 2)
Scale up "imperfect-app" to 3 instances
Check to see if you have 3 instances
running
Visit the random URL in your browser
(again)
Click "Crash me" on the page.
Click "See if an app instance is available"
See where you are.
Keep doing the last three steps...
TASKS
• cf scale imperfect-app -i 3
• cf app imperfect-app
• Look for Number of instances
"running". (should see 0-2)
• Use the URL from the previous page.
• Click the "Crash me" link.
• Click "See if an app instance is available" hit
original app URL or remove the /crash
• You should be running on an instance
besides "0".
Cheat Sheet
36
Making Apps Resilient (part 3)
Delete the app to cleanup your
space.
TASKS
• cf delete imperfect-app
• cf apps (should show "No apps
found")
Cheat Sheet
37
Info And Training
And “Other"
Session Links
38
38
https://www.cloudfoundr
y.org/
https://zero-to-
hero.engineerbetter.com/
https://www.cloudfoundry.org/wh
y-cloud-foundry/
https://www.cloudfoun
dry.org/thefoundry/#c
ert-distros
Info and Training
Links
39
Other Cloud Foundry Sessions @ SUSECON Digital 2020Fill in later
40
Extra Credit Lab 7 And Beyond
Find Lab #7 at the end of this presentation. We skipped Lab #6, we thought
Lab #7 was more critical.
Find additional labs and other learning ideas at:
• http://basics-workshop.cloudfoundry.org/
42
Lab #7 (Yes, we
skipped Lab #6)
Share Persistent
Data Between App
Instances
43
Dealing With State (part 1)
Look at the services available on
this CF instance.
(cf marketplace)
Create a free "nano" instance of
Redis that you can use to store
"state"
Test that you have a good service
running
TASKS
• cf marketplace
• cf marketplace -s a9s-redis40
• cf create-service a9s-
redis40 redis-single-nano myredis
• cf services
• watch cf services
• (it will take some time for the
service to be created)
cf services
Cheat Sheet
44
Dealing With State (part 2)
Change Directory to the 07-shared-
state/stateful-app
Push this app with the --no-start flag
Use "cf bind-service" to bind the
service you created and the app
Did it work? Can you find out the
status?
Start the app and see if it bound to the
Redis service correctly
TASKS
• cd training-zero-to-hero/07-shared-
state/stateful-app
• cf push --no-start
• cf bind-service --help
• cf bind-service stateful-app myredis
• cf start stateful-app
• cf env stateful-app
• Look for the VCAP_SERVICES section
and find the Redis service.
Cheat Sheet
45
Dealing With State (part 3)
Visit the App in the Browser
See how many visits have been
made?
Restart the app and revisit the app in
the browser.
Observe that the total visits did not
reset. Why?
TASKS
• Look for URL next to "routes:"
• Cut/Paste this URL
into the browser
• cf restart stateful-app
• Data is stored in the stateful Redis
service
Cheat Sheet
46
Dealing With State (part 4)
Increase the number of instances
of the stateful-app
Keep revisiting the app and see
how the counters react (single
instance vs total number of hits)
TASKS
• cf scale stateful-app -i 4
• Use URL AND REFRESH
Cheat Sheet
47
Dealing With State (part 5)
Stop, and unbind the stateful-app
from the Redis service
Bind the app to the service (again)
What do you think will happen?
TASKS
• cf stop stateful-app
• cf unbind-service stateful-app myredis
• cf bind-service stateful-app myredis
• Application retain or lose the count
data?
Cheat Sheet
48
Dealing With State (part 6)
Delete the Redis service
Did that work?
How can you delete the Redis service?
Recreate the Redis service, and bind it to
the stateful-app
Start the app
What do you think will happen?
TASKS
• cf stop stateful-app
• cf unbind-service stateful-app myredis
• cf delete-service myredis
• cf services
• cf create-service a9s-redis40 redis-single-
nano myredis
• watch cf services
• cf bind-service stateful-app myredis
• cf start stateful-app
• Instance count reset
Cheat Sheet
49
Dealing With State (part 7)
Delete the Redis service and app
to cleanup your space.
TASKS
• cf stop stateful-app
• cf unbind-service stateful-app myredis
• cf delete-service myredis
• cf delete stateful-app
• cf apps (should show "No apps found")
• cf services (should show "No services
found")
Cheat Sheet
50
IN CASE EMAILS
• [email protected] - susecon2019
• [email protected] - susecon2019
• [email protected] - susecon2019
• [email protected] - susecon2019
51
General Disclaimer
This document is not to be construed as a promise by any participating company to
develop, deliver, or market a product. It is not a commitment to deliver any material,
code, or functionality, and should not be relied upon in making purchasing
decisions. SUSE makes no representations or warranties with respect to the contents of
this document, and specifically disclaims any express or implied warranties of
merchantability or fitness for any particular purpose. The development, release, and
timing of features or functionality described for SUSE products remains at the sole
discretion of SUSE. Further, SUSE reserves the right to revise this document and to
make changes to its content, at any time, without obligation to notify any person or entity
of such revisions or changes. All SUSE marks referenced in this presentation are
trademarks or registered trademarks of SUSE, LLC, Inc. in the United States and other
countries. All third-party trademarks are the property of their respective owners.