Introduction to Cloud Computing
SoC Summer Workshop
Cloud Computing with Big Data
Richard T. B. Ma
School of Computing
National University of Singapore
About Your Lecturer
q Email: 𝑡𝑏𝑚𝑎@𝑐𝑜𝑚𝑝. 𝑛𝑢𝑠. 𝑒𝑑𝑢. 𝑠𝑔
q Office: COM3 #02-14
q Website: 𝑤𝑤𝑤. 𝑐𝑜𝑚𝑝. 𝑛𝑢𝑠. 𝑒𝑑𝑢. 𝑠𝑔/~𝑡𝑏𝑚𝑎/
q Research areas:
v Computer Networks
v Distributed Systems
2
About Your TA
q Yancan MAO
q Email: 𝑚𝑎𝑜𝑦𝑎𝑛𝑐𝑎𝑛@𝑢. 𝑛𝑢𝑠. 𝑒𝑑𝑢
q Office: Systems and Networking Research
Lab at COM3
q Research: Distributed Stream Systems
3
Schedule: Online
4
Schedule: On-Campus
5
Tentative Topics of This Course
q Lecture 0: Introduction to Cloud Computing
v Concepts and principles of cloud computing
v Cloud computing service (delivery) models
v Virtualization technology
q Lecture 1-4: Cloud-native App Development
v Kubernetes Services and Networking
v Kubernetes Native Objects
v Cloud-Native Design Patterns
v Extension, Customized Designs
q Lecture 5: Distributed Big Data Systems
v Batch and Stream processing systems
6
Style of This Course
q Lectures
v introduce fundamental concepts
v provide minimal examples/illustrations
v provide some pointers to references
q The expectations for students
v spend time to digest knowledge
v explore open-source software systems
v design and implement an end-to-end cloud app
7
Course Project
q This course is a project-based workshop
v besides lectures, students will spend more time
on projects, which will be graded
v learn from hands-on experiences
v every 4 students form a group
v poster, presentation and report
q Project content
v open-ended project with your preference
v must apply cloud-native designs of your app
v may use big data frameworks
8
Prerequisites and Resources
q Prerequisites
v Programming Languages, e.g., Python, Java, Go
v Operating Systems, i.e., Linux
v Computer Networks, e.g., L2 and L3 networking
q Cloud Resources
v Trial on real production cloud: Amazon EC2
v Each student will receive US$100 credits for
the use of AWS services; available in July
v Credit card tie-in not required
9
Roadmap
q General Concepts of Cloud Computing
v Cloud and cloud computing
v Service models
q Virtualization Technologies
v Virtual Machines
v Containers
q Container Orchestration
v Introduction to Kubernetes
10
What is a Cloud?
q A cloud is a network that
delivers requested virtual
resources as a service
[IBM’s definition]
q The term “cloud” is used
as a metaphor for the
Internet, an abstraction
of computing resources
v Computing resources are
aggregated in datacenters
11
Datacenter
v Commodity
servers are
organized in
racks
v Racks are
connected by
high-speed
network links
12
A More Complete View of a Datacenter
Google datacenter video:
https://www.youtube.com/watch?v=XZmGGAbHqa0
13
What is Cloud Computing?
q A definition from National Institute of
Standards and Technology (NIST)
v Cloud computing is a model for enabling convenient,
on-demand network access to a shared pool of
configurable computing resources (e.g., networks,
servers, storage, applications, and services) that
can be rapidly provisioned and released with
minimal management effort or service provider
interaction.
Peter Mell and Tim Grance, “The NIST Definition of Cloud Computing”, 2011
14
Cloud Computing: Key Characteristics
1. On-demand self-service
v driven by user requests; no human interaction with the cloud
2. Ubiquitous network access
v deliver services anytime, anywhere, providing a secure,
“always-on” computing infrastructure
3. Resource pooling
v share resources among several clients, providing everyone
with a different set of services per their requirements
4. Elasticity
v resources can be rapidly and elastically scaled up or down,
based on the workload requirements & usage characteristics
5. Measured service
v metered for usage and charged for through pricing models;
service level agreements (SLAs) for quality of service 15
Cloud Computing: Service Models
16
One Trend: Serverless Computing
q Concept: Allows a user to simply write the code
and leaves all the server provisioning and
administration tasks to the cloud provider
q Serverless computing = FaaS + BaaS
v FaaS (Function-as-a-Service): cloud functions
v BaaS (Backend-as-a-Service): serverless frameworks
“Cloud Programming Simplified: A Berkeley View on Serverless Computing”, 2019
17
What is Cloud Computing?
q An alternative definition from Berkeley
v Cloud computing refers to both the applications
delivered as services over the Internet and the
hardware and systems software in the datacenters
that provide those services
v Cloud refers to an environment of datacenter
hardware and software
q Key questions of our interests
v how did cloud achieve such characteristics?
v how to enable services using cloud-native patterns?
Armbrust et al., “A View of Cloud Computing”, Comm. of the ACM, 2010
18
Successful Cases
q Clouds in Market
v Amazon: EC2 (Elastic Compute Cloud)
v Google: Gmail, Google Maps, Google Calendar, …
v Microsoft: Azure
v IBM: Blue Cloud
v Salesforce: Sales Cloud, Service Cloud, Custom Cloud
v Yahoo: Yahoo Cloud Computing
v Byte Dance: ByteHouse
v Alibaba: Aliyun,
v Baidu: Baiduyun
19
Roadmap
q General Concepts of Cloud Computing
v Cloud and cloud computing
v Service models
q Virtualization Technologies
v Virtual Machines
v Containers
q Container Orchestration
v Introduction to Kubernetes
20
Virtualization and Virtual Machines
q general concept
v an example
21
KVM and QEMU
q KVM
v a hypervisor for
Linux on the
“x86” hardware
v has a kernel
module kvm.ko
q QEMU
v a virtualizer and
machine emulator
v run in user space
22
Two problems of VM
q Cost Problem
v Each VM needs an OS
v Each OS has overhead
q Deployment Problem
v Apps need a development environment
• configurations
• other software components
• OS-dependent Bins/Libs
v Deploying an app to VM needs/is
• dependencies on the guest OS
• time consuming and error prone
23
Solution: Container
q Sharing a single OS
v Each container runs its own
isolated environment
v Each container is portable
q Based on executable image
v Filesystem snapshot that contains
• app codes, config files & libraries
• environment variables and runtime
v Immutable
v Stored in registries
v Layered architecture
• built from a base image
24
Docker Architecture
q Docker registry
v Docker Hub
v Trusted Registry
q Docker includes v Private Registry
v Docker client v Local Registry
v Docker daemon
25
Dockerfile
q How to create Images?
26
Layered Architecture of Images
27
Docker Engine
q How to create a container runtime?
https://tarangsharma.hashnode.dev/docker-engine-architecture
28
Secrets of container runtime & image
q Control groups (limit an application
to a specific set of HW resources)
q Namespaces (container isolation)
v The pid namespace: Process isolation (PID: Process ID).
v The net namespace: Managing network interfaces.
v The ipc namespace: Managing access to IPC resources.
v The mnt namespace: Managing filesystem mount points.
v The uts namespace: Isolating kernel and version
identifiers. (UTS: Unix Timesharing System).
q Union file systems (layered image)
v UnionFS are file systems that operate by creating layers,
making them very lightweight and fast.
29
q Open Standards on
v Image specification
v Runtime specification
v Distribution specification
https://opencontainers.org
30
Summary: Containers vs VMs
q Containers q Virtual Machines
v Run on execution engine v Run on hypervisor
v Share the host OS v Each VM runs own OS
v OS-level virtualization v HW-level virtualization
v Process-level isolation; v Fully isolated; more
less secure secure
Ø Lightweight Ø Heavyweight
Ø Startup in millisecs Ø Startup in minutes
Ø No memory isolation Ø Allocated memory
Ø Native performance Ø Limited performance
31
Roadmap
q General Concepts of Cloud Computing
v Cloud and cloud computing
v Service models
q Virtualization Technologies
v Virtual Machines
v Containers
q Container Orchestration
v Introduction to Kubernetes
32
Architectures for application development
33
Container Orchestration
automated management, deployment, scaling,
and operation of containerized applications
Introducing Kubernetes
Kubernetes is a portable, extensible,
open-source platform for managing
containerized workloads and services,
that facilitates both declarative
configuration and automation.
What Kubernetes can do?
q Service discovery and load balancing
q Storage orchestration
q Automated rollouts and rollbacks
q Automatic bin packing
q Self-healing
q Secret and configuration management
q Batch execution
q Horizontal scaling
q Designed for extensibility
36
Pros and Cons
https://blog.bytebytego.com/p/kubernetes-when-and-how-to-apply 37
Cloud Native Computing Foundation
https://www.cncf.io
Kubernetes Architecture
https://kubernetes.io/docs/concepts/architecture/
39
40
What is a Pod?
q A pod is a group of container(s)
q Pod is the smallest unit that Kubernetes admins.
q Pods are supposed to be ephemeral, i.e., can die.
q It provides an abstraction over container, abstract away the
container details.
q It creates a runtime environment for containers, which are
always co-located, co-scheduled and run in a shared context.
v Shared context allows the individual containers inside a pod to be
treated collectively as a single app as if all the containerized processes
were running together on the same host in more traditional workloads.
v Containers in a pod share the same resources such as memory, storage
and internal/virtual IP address.
41
Kubernetes Architecture
https://devopscube.com/kubernetes-architecture-explained/ 42
43
How can I try Kubernetes?
q Minikube
v https://minikube.sigs.k8s.io/docs/start/
q Kubernetes playgrounds
v https://labs.play-with-k8s.com
v https://killercoda.com/playgrounds/scenario/kubernetes
v https://labs.iximiuz.com/playgrounds?category=kubernetes
q Amazon EC2 resources at NUS
v each student will have $100 credits
v available when you join in July
44
Kubectl Commands
q Check the cluster
$kubectl get nodes
$kubectl get componentstatuses
q Create/delete a pod (not recommended)
$kubectl run mypod --image=$user/$image
$kubectl delete mypod
q Check a pod
$kubectl describe pod mypod
q Remote access to a pod
$kubectl exec mypod –stdin –tty -- /bin/bash
45
Declarative Paradigm
q Use a pod manifest file
v e.g., mypod.yaml
q Create/update a pod
$kubectl apply –f mypod.yaml
q Delete a pod
$kubectl delete –f mypod.yaml
46
Docker vs Kubernetes
47