SlideShare a Scribd company logo
Cloud Native Node.js
Create and Deploy Cloud Native Node.js Applications
Beth Griggs
Node.js Core Collaborator,
Runtimes @ IBM
@BethGriggs_BethGriggs
What are Cloud Native Applications?
Why Node.js in the Cloud?
1,150
897
1
14
24
422
Startup
• Availability
• Scaling
Memory
• Efficiency
• Cost
IO Speed
• Performance
• Scale
The State of Cloud Native Development
Node.js Foundation Survey
2018
Evans Cloud Development Survey
2017
node-js.slack.com
#cloudnative
github.com/
CloudNativeJS
CloudNativeJS.io @cloudnativejs
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
• Tool designed to make it easier to create, deploy, and run
applications by using containers
• Allows you to package up an application with all of the parts it
needs, such as libraries and other dependencies
• Docker is a bit like a virtual machine, but rather than creating a
whole virtual operating system, Docker allows applications to use
the same Linux kernel
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
package.json
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
package.json
node_modules
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
package.json
node_modules
Application
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
# Change working directory
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Copy package.json and package-lock.json
COPY package*.json /app/
# Install app dependencies
RUN npm install —-production
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
package.json
node_modules
Application
716 MB
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package*.json /app/
RUN npm install —-production
Node.js 10 Docker Image
Operating System Updates
package.json
node_modules
716 MB
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package*.json /app/
RUN npm install —-production
# Copy the dependencies into a Slim Node docker image
FROM node:10-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
Node.js 10 Docker Image
Operating System Updates
package.json
node_modules
716 MB
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package.json /app/
RUN npm install —production
# Copy the dependencies into a Slim Node docker image
FROM node:10-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
node_modules
716 MB
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package.json /app/
RUN npm install —production
# Copy the dependencies into a Slim Node docker image
FROM node:10-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
node_modules
716 MB
Node.js 10 SLIM Docker Image
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:8
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package.json /app/
RUN npm install —production
# Copy the dependencies into a Slim Node docker image
FROM node:8-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
node_modules
716 MB
Node.js 10 SLIM Docker Image
Operating System Updates
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:8
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package.json /app/
RUN npm install —production
# Copy the dependencies into a Slim Node docker image
FROM node:8-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
node_modules
716 MB
Node.js 8 SLIM Docker Image
Operating System Updates
package.json
Application
229 MB
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
FROM node:10
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY package.json /app/
RUN npm install —production
# Copy the dependencies into a Slim Node docker image
FROM node:10-slim
WORKDIR "/app"
# Install OS updates
RUN apt-get update && apt-get dist-upgrade -y && apt-get clean 
&& echo 'Finished installing dependencies'
# Install app dependencies
COPY --from=0 /app/node_modules /app/node_modules
COPY . /app
ENV NODE_ENV production
ENV PORT 3000
USER node
EXPOSE 3000
CMD ["npm", "start"]
node_modules
Node.js 10 SLIM Docker Image
Operating System Updates
package.json
Application
$ docker build -t node-app -f Dockerfile-run .
$ docker run -d —p 3000:3000 -t node-app
$ docker push bethgriggs/node-app:1.0.0
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
Manages your
containers
• Service discovery and load balancing
• Storage orchestration
• Automated rollouts and rollbacks
• Self-healing
• Secret and configuration
management
HELM CHARTS
• Helm uses a packaging format called charts.
• A chart is a collection of files that describe a related set of Kubernetes
resources.
• A bit like package.json for Kubernetes deployment
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
https://github.com/CloudNativeJS/helm
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
apiVersion: v1
description: A Helm chart for Kubernetes
name: nodeserver
version: 1.0.0
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 1
maxReplicas: 2
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 1
maxReplicas: 2
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 1
maxReplicas: 2
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 1
maxReplicas: 2
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 5
maxReplicas: 9
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 5
maxReplicas: 9
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
HELM CHARTS
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
/chart/nodeserver/templates/basedeployment.yaml
/chart/nodeserver/templates/deployment.yaml
/chart/nodeserver/templates/service.yaml
/chart/nodeserver/templates/hpa.yaml
/chart/nodeserver/templates/istio.yaml
/chart/nodeserver/Chart.yaml
/chart/nodeserver/values.yaml
replicaCount: 1
revisionHistoryLimit: 1
image:
repository: nodeserver
tag: 1.0.0
pullPolicy: IfNotPresent
resources:
requests:
cpu: 200m
memory: 300Mi
livenessProbe:
initialDelaySeconds: 3000
periodSeconds: 1000
service:
name: Node
type: NodePort
servicePort: 3000
hpa:
enabled: false
minReplicas: 5
maxReplicas: 9
metrics:
cpu:
targetAverageUtilization: 70
memory:
targetAverageUtilization: 70
services:
base:
enabled: false
replicaCount: 1
image:
tag : v0.9.9
weight: 100
istio:
enabled: false
weight: 100
prometheus:
$ cd ./chart/nodeserver/
$ helm install —name nodeserver .
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
Health Checks
HTTP Requests
Health Checks
HTTP Requests
GET: /ready
GET: /ready
Health Checks
HTTP Requests
GET: /ready 200
GET: /ready 200
Health Checks
HTTP Requests
GET: /ready 200
GET: /health 200
GET: /ready 200
GET: /health 200
Health Checks
HTTP Requests
GET: /ready 503
GET: /health 503
GET: /ready 200
GET: /health 200
Health Checks
HTTP Requests
GET: /ready 503
GET: /health 503
GET: /ready 200
GET: /health 200
SIGTERM
Health Checks
HTTP Requests
GET: /ready 503
GET: /health 503
GET: /ready 200
GET: /health 200
SIGTERM
SIGKILL
Health Checks
HTTP Requests
GET: /ready 503
GET: /health 503
GET: /ready 200
GET: /health 200
SIGTERM
SIGKILL
Health Checks
HTTP Requests
GET: /ready 503
GET: /health 200
GET: /ready 200
GET: /health 200
GET: /ready 200
GET: /health 200
GET: /ready 200
GET: /health 200
Health Checks
HTTP Requests
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
const health = require(‘@cloudnative/health-connect');
let healthcheck = new health.HealthChecker();
const readyPromise = new Promise(function (resolve, _reject) {
resolve();
});
let readyCheck = new health.ReadinessCheck("ready", readyPromise);
const livePromise = new Promise(function (resolve, _reject) {
resolve();
});
let liveCheck = new health.LivenessCheck("live", livePromise);
const shutdownPromise = new Promise(function (resolve, _reject) {
resolve();
});
let shutdownCheck = new health.ShutdownCheck(“shut”, shutdownProm);
healthcheck.registerReadinessCheck(readyCheck);
healthcheck.registerLivenessCheck(liveCheck);
healthcheck.registerShutdownCheck(shutdownCheck);
app.use('/ready', health.ReadinessEndpoint(healthcheck))
app.use('/health', health.LivenessEndpoint(healthcheck))
-
Health Checks
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
GET: /ready 200
GET: /health 200
GET: /metrics
GET: /ready 200
GET: /health 200
GET: /metrics
HTTP Requests
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
const prometheus = require(‘appmetrics-prometheus’).attach();-
FullStack London - Cloud Native Node.js
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
CATALOG
ORDER
INVENTORY
USER
MySQL
MongoDB
SPARK
ELASTICSEARCH
BACKEND FOR
FRONTEND
MICROSERVICES SERVICES
LOAD
BALANCER
• func add(_ a: Int,
to b: Int) -> Void {
• print(a + b)
• }
• let a = ”5”
• let b = 3
• add(a, to: b)
• > swiftc main.swift
const zipkin = require(‘appmetrics-zipkin’);-
Distributed Tracing
Monitoring
Health Checking
Container Orchestration
Tutorial: https://github.com/CloudNativeJS/Tutorial
node-js.slack.com
#cloudnative
github.com/
CloudNativeJS
CloudNativeJS.io @cloudnativejs
10 Key
Attributes of
Cloud Native
Applications
1. Packaged as lightweight containers
2. Developed with appropriate languages and
frameworks
3. Designed as loosely coupled microservices
4. Centered around APIs
5. Separates stateful and stateless services
6. Portable, isolated from server and operating
system dependencies
7. Deployed on self-service, elastic, cloud
infrastructure
8. Managed through agile DevOps processes
9. Automated capabilities – Infrastructure as code
10. Defined, policy-driven resource allocation
https://thenewstack.io/10-key-attributes-of-cloud-native-applications/

More Related Content

PPTX
London Node.js User Group - Cloud-native Node.js
PDF
Node Summit 2018: Cloud Native Node.js
PDF
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
PDF
Docker and Puppet for Continuous Integration
PPT
Python virtualenv & pip in 90 minutes
PDF
Cloud Foundry Summit 2015: 10 common errors when pushing apps to cloud foundry
PDF
Automating the Network
PDF
Ansible best practices
London Node.js User Group - Cloud-native Node.js
Node Summit 2018: Cloud Native Node.js
Silicon Valley Code Camp 2019 - Reaching the Cloud Native World
Docker and Puppet for Continuous Integration
Python virtualenv & pip in 90 minutes
Cloud Foundry Summit 2015: 10 common errors when pushing apps to cloud foundry
Automating the Network
Ansible best practices

What's hot (20)

PDF
Puppet in the Pipeline
PDF
今すぐ始めるCloud Foundry #hackt #hackt_k
PDF
Using Docker with Puppet - PuppetConf 2014
PDF
Provisioning & Deploying with Docker
PPTX
Zero to Continuous Delivery on Google Cloud
PDF
Deploying an application with Chef and Docker
PPTX
Baking docker using chef
PDF
Antons Kranga Building Agile Infrastructures
PPTX
Techbash 2017 - Modernizing Traditional.NET Apps with Docker
PDF
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
PPT
Learn jobDSL for Jenkins
PDF
Ansible-for-openstack
PDF
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
PDF
Docker Basics & Alfresco Content Services
PPTX
Installaling Puppet Master and Agent
PPTX
Get started with docker & dev ops
PDF
Configuring Highly Scalable Compile Masters, Vasco Cardoso, AWS
PDF
GO-CFを試してみる
PPTX
Docker, OSS and Azure
PDF
Jenkins Docker
Puppet in the Pipeline
今すぐ始めるCloud Foundry #hackt #hackt_k
Using Docker with Puppet - PuppetConf 2014
Provisioning & Deploying with Docker
Zero to Continuous Delivery on Google Cloud
Deploying an application with Chef and Docker
Baking docker using chef
Antons Kranga Building Agile Infrastructures
Techbash 2017 - Modernizing Traditional.NET Apps with Docker
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Learn jobDSL for Jenkins
Ansible-for-openstack
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Docker Basics & Alfresco Content Services
Installaling Puppet Master and Agent
Get started with docker & dev ops
Configuring Highly Scalable Compile Masters, Vasco Cardoso, AWS
GO-CFを試してみる
Docker, OSS and Azure
Jenkins Docker
Ad

Similar to FullStack London - Cloud Native Node.js (20)

PDF
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
PDF
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
PDF
Getting started docker notes
PDF
Swift Cloud Workshop - Swift Microservices
PDF
Présentation "Docker + Kubernetes" @ Pastis.tech #2
PDF
Using Docker For Development
PDF
Containerizing a Web Application with Vue.js and Java
PDF
"Master production-grade best practices to build your Node.js Docker images",...
PPTX
Setup docker on existing application
PPTX
Pluralsight Webinar: Simplify Your Project Builds with Docker
PPTX
Build Once, Run Anywhere: The Rise of Containerization in Modern IT
PDF
DCSF 19 Node.js Rocks in Docker for Dev and Ops
PDF
Node.js Rocks in Docker for Dev and Ops
PDF
(C)NodeJS
PPTX
Learn Electron for Web Developers
PPTX
Tribal Nova Docker workshop
PDF
Server(less) Swift at SwiftCloudWorkshop 3
KEY
nodecalgary1
PPTX
Docker for Development
PDF
Ch2.setup.node.and.npm
Node Interactive: Node.js Performance and Highly Scalable Micro-Services
IBM Cloud University: Build, Deploy and Scale Node.js Microservices
Getting started docker notes
Swift Cloud Workshop - Swift Microservices
Présentation "Docker + Kubernetes" @ Pastis.tech #2
Using Docker For Development
Containerizing a Web Application with Vue.js and Java
"Master production-grade best practices to build your Node.js Docker images",...
Setup docker on existing application
Pluralsight Webinar: Simplify Your Project Builds with Docker
Build Once, Run Anywhere: The Rise of Containerization in Modern IT
DCSF 19 Node.js Rocks in Docker for Dev and Ops
Node.js Rocks in Docker for Dev and Ops
(C)NodeJS
Learn Electron for Web Developers
Tribal Nova Docker workshop
Server(less) Swift at SwiftCloudWorkshop 3
nodecalgary1
Docker for Development
Ch2.setup.node.and.npm
Ad

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
cuic standard and advanced reporting.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation theory and applications.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
KodekX | Application Modernization Development
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
cuic standard and advanced reporting.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation theory and applications.pdf
MIND Revenue Release Quarter 2 2025 Press Release
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Reach Out and Touch Someone: Haptics and Empathic Computing
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
KodekX | Application Modernization Development
Agricultural_Statistics_at_a_Glance_2022_0.pdf

FullStack London - Cloud Native Node.js

  • 1. Cloud Native Node.js Create and Deploy Cloud Native Node.js Applications Beth Griggs Node.js Core Collaborator, Runtimes @ IBM @BethGriggs_BethGriggs
  • 2. What are Cloud Native Applications?
  • 3. Why Node.js in the Cloud? 1,150 897 1 14 24 422 Startup • Availability • Scaling Memory • Efficiency • Cost IO Speed • Performance • Scale
  • 4. The State of Cloud Native Development Node.js Foundation Survey 2018 Evans Cloud Development Survey 2017
  • 7. • Tool designed to make it easier to create, deploy, and run applications by using containers • Allows you to package up an application with all of the parts it needs, such as libraries and other dependencies • Docker is a bit like a virtual machine, but rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel
  • 8. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"]
  • 9. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image
  • 10. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates
  • 11. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates package.json
  • 12. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates package.json node_modules
  • 13. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates package.json node_modules Application
  • 14. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 # Change working directory WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Copy package.json and package-lock.json COPY package*.json /app/ # Install app dependencies RUN npm install —-production COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates package.json node_modules Application 716 MB
  • 15. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package*.json /app/ RUN npm install —-production Node.js 10 Docker Image Operating System Updates package.json node_modules 716 MB
  • 16. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package*.json /app/ RUN npm install —-production # Copy the dependencies into a Slim Node docker image FROM node:10-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] Node.js 10 Docker Image Operating System Updates package.json node_modules 716 MB
  • 17. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package.json /app/ RUN npm install —production # Copy the dependencies into a Slim Node docker image FROM node:10-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] node_modules 716 MB
  • 18. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package.json /app/ RUN npm install —production # Copy the dependencies into a Slim Node docker image FROM node:10-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] node_modules 716 MB Node.js 10 SLIM Docker Image
  • 19. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:8 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package.json /app/ RUN npm install —production # Copy the dependencies into a Slim Node docker image FROM node:8-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] node_modules 716 MB Node.js 10 SLIM Docker Image Operating System Updates
  • 20. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:8 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package.json /app/ RUN npm install —production # Copy the dependencies into a Slim Node docker image FROM node:8-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] node_modules 716 MB Node.js 8 SLIM Docker Image Operating System Updates package.json Application
  • 21. 229 MB • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift FROM node:10 WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY package.json /app/ RUN npm install —production # Copy the dependencies into a Slim Node docker image FROM node:10-slim WORKDIR "/app" # Install OS updates RUN apt-get update && apt-get dist-upgrade -y && apt-get clean && echo 'Finished installing dependencies' # Install app dependencies COPY --from=0 /app/node_modules /app/node_modules COPY . /app ENV NODE_ENV production ENV PORT 3000 USER node EXPOSE 3000 CMD ["npm", "start"] node_modules Node.js 10 SLIM Docker Image Operating System Updates package.json Application
  • 22. $ docker build -t node-app -f Dockerfile-run . $ docker run -d —p 3000:3000 -t node-app $ docker push bethgriggs/node-app:1.0.0
  • 24. Manages your containers • Service discovery and load balancing • Storage orchestration • Automated rollouts and rollbacks • Self-healing • Secret and configuration management
  • 25. HELM CHARTS • Helm uses a packaging format called charts. • A chart is a collection of files that describe a related set of Kubernetes resources. • A bit like package.json for Kubernetes deployment
  • 26. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml https://github.com/CloudNativeJS/helm
  • 27. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml apiVersion: v1 description: A Helm chart for Kubernetes name: nodeserver version: 1.0.0
  • 28. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 1 maxReplicas: 2 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 29. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 1 maxReplicas: 2 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 30. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 1 maxReplicas: 2 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 31. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 1 maxReplicas: 2 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 32. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 5 maxReplicas: 9 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 33. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 5 maxReplicas: 9 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 34. HELM CHARTS • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift /chart/nodeserver/templates/basedeployment.yaml /chart/nodeserver/templates/deployment.yaml /chart/nodeserver/templates/service.yaml /chart/nodeserver/templates/hpa.yaml /chart/nodeserver/templates/istio.yaml /chart/nodeserver/Chart.yaml /chart/nodeserver/values.yaml replicaCount: 1 revisionHistoryLimit: 1 image: repository: nodeserver tag: 1.0.0 pullPolicy: IfNotPresent resources: requests: cpu: 200m memory: 300Mi livenessProbe: initialDelaySeconds: 3000 periodSeconds: 1000 service: name: Node type: NodePort servicePort: 3000 hpa: enabled: false minReplicas: 5 maxReplicas: 9 metrics: cpu: targetAverageUtilization: 70 memory: targetAverageUtilization: 70 services: base: enabled: false replicaCount: 1 image: tag : v0.9.9 weight: 100 istio: enabled: false weight: 100 prometheus:
  • 35. $ cd ./chart/nodeserver/ $ helm install —name nodeserver .
  • 38. Health Checks HTTP Requests GET: /ready GET: /ready
  • 39. Health Checks HTTP Requests GET: /ready 200 GET: /ready 200
  • 40. Health Checks HTTP Requests GET: /ready 200 GET: /health 200 GET: /ready 200 GET: /health 200
  • 41. Health Checks HTTP Requests GET: /ready 503 GET: /health 503 GET: /ready 200 GET: /health 200
  • 42. Health Checks HTTP Requests GET: /ready 503 GET: /health 503 GET: /ready 200 GET: /health 200 SIGTERM
  • 43. Health Checks HTTP Requests GET: /ready 503 GET: /health 503 GET: /ready 200 GET: /health 200 SIGTERM SIGKILL
  • 44. Health Checks HTTP Requests GET: /ready 503 GET: /health 503 GET: /ready 200 GET: /health 200 SIGTERM SIGKILL
  • 45. Health Checks HTTP Requests GET: /ready 503 GET: /health 200 GET: /ready 200 GET: /health 200
  • 46. GET: /ready 200 GET: /health 200 GET: /ready 200 GET: /health 200 Health Checks HTTP Requests
  • 47. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift const health = require(‘@cloudnative/health-connect'); let healthcheck = new health.HealthChecker(); const readyPromise = new Promise(function (resolve, _reject) { resolve(); }); let readyCheck = new health.ReadinessCheck("ready", readyPromise); const livePromise = new Promise(function (resolve, _reject) { resolve(); }); let liveCheck = new health.LivenessCheck("live", livePromise); const shutdownPromise = new Promise(function (resolve, _reject) { resolve(); }); let shutdownCheck = new health.ShutdownCheck(“shut”, shutdownProm); healthcheck.registerReadinessCheck(readyCheck); healthcheck.registerLivenessCheck(liveCheck); healthcheck.registerShutdownCheck(shutdownCheck); app.use('/ready', health.ReadinessEndpoint(healthcheck)) app.use('/health', health.LivenessEndpoint(healthcheck)) - Health Checks
  • 49. GET: /ready 200 GET: /health 200 GET: /metrics GET: /ready 200 GET: /health 200 GET: /metrics HTTP Requests
  • 50. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift const prometheus = require(‘appmetrics-prometheus’).attach();-
  • 60. • func add(_ a: Int, to b: Int) -> Void { • print(a + b) • } • let a = ”5” • let b = 3 • add(a, to: b) • > swiftc main.swift const zipkin = require(‘appmetrics-zipkin’);-
  • 64. 10 Key Attributes of Cloud Native Applications 1. Packaged as lightweight containers 2. Developed with appropriate languages and frameworks 3. Designed as loosely coupled microservices 4. Centered around APIs 5. Separates stateful and stateless services 6. Portable, isolated from server and operating system dependencies 7. Deployed on self-service, elastic, cloud infrastructure 8. Managed through agile DevOps processes 9. Automated capabilities – Infrastructure as code 10. Defined, policy-driven resource allocation https://thenewstack.io/10-key-attributes-of-cloud-native-applications/