SlideShare a Scribd company logo
1 of 40
Download to read offline
Running gRPC Services
for Serving Legacy RESTful API on
Kubernetes
Who We Are
Sungwon Lee / Whale
Buzzvil Chief Architect
Hoseong Hwang / Liam
Buzzvil DevOps Lead
Why?
Why did we choose gRPC?
Why do we still need to support REST API?
Why microservices architecture?
There are so many
domains and stakeholders
in ad-tech industry.
Why gRPC?
Performance matters
Multiple services increases network latency
Ad request should be done within 100ms
API-first Approach
Need to support polyglot
IDL(Interface Definition Language) required
gRPC is great, but..
We still need to support legacy RESTful JSON API
There are partners
using the legacy APIs
REST APIs:
mostly beloved
API protocol
B2B business
Support both gRPC/REST protocols
Build a server for transcoding?
gRPC ServerREST JSON
Transcoding
server
Client
Expensive maintenance cost
1. Parse JSON request
2. Transform JSON to gRPC
Request
3. Send request to gRPC Server
4. Transcode gRPC response to
JSON format
5. Send a response to the client
It seems familiar!
Istio Service Mesh
Moving to Microservices
Micoservices grow in size and complexity
Difficult to understand and manage
Service Mesh
Detach network logic from business logic
Monolythic Microservice
Microservice Proxy
Microservice Proxy
Istio Service Mesh
Let’s Try It !
Setup Protobuf for Custom Routes
Setup Istio/EnvoyFilter for gRPC JSON transcoder
Setup Protocol Buffers
service CalendarApi {
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse);
// ...
}
The easiest way: Do nothing.
Transcoder will handle it automatically.
Setup Protocol Buffers (Cont.)
package buzzvil.calendar.v1;
service CalendarApi {
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse);
}
$ curl -X POST https://host.here/buzzvil.calendar.v1.CalendarApi/ListEvents
=
POST /<package>.<service>/<method>
Setup Protocol Buffers (Cont.)
package buzzvil.calendar.v1;
service CalendarApi {
rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) {
option (google.api.http) = { get: "/v1/events" };
}
}
Custom routes: google.api.http annotation
$ curl -X GET https://host.here/v1/events
Setup Protocol Buffers (Cont.)
Parameters
service CalendarApi {
rpc UpdateEvent(UpdateEventRequest)
returns (Event) {
option (google.api.http) = {
put: "/v1/events/{event.id}",
body: "event"
};
}
}
message Event {
int64 id = 1;
string name = 2;
}
message UpdateEventRequest {
Event event = 1;
}
Setup Envoy Proxy
Let’s try Istio /
EnvoyFilter to setup
envoy sidecar proxy
Setup Envoy Proxy (Cont.)
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: example-transcoder
namespace: example-namespace
spec:
workloadLabels:
...
filters:
- listenerMatch:
listenerType: SIDECAR_INBOUND
filterName: envoy.grpc_json_transcoder
filterType: HTTP
filterConfig:
proto_descriptor: “path/to/bin”
match_incoming_request_route: True
auto_mapping: False
services:
- buzzvil.calendar.v1.CalendarApi
filterName: envoy.grpc_json_transcoder
match_incoming_request_route: True
Services:
- buzzvil.calendar.v1.CalendarApi
Apply grpc_json_transcoder
filter to the services
Use the specified route
Setup Envoy Proxy (Cont.)
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: example-transcoder
namespace: example-namespace
spec:
workloadLabels:
...
filters:
- listenerMatch:
listenerType: SIDECAR_INBOUND
filterName: envoy.grpc_json_transcoder
filterType: HTTP
filterConfig:
proto_descriptor: “path/to/bin”
match_incoming_request_route: True
auto_mapping: False
services:
- buzzvil.calendar.v1.CalendarApi
Proto Descriptor
Envoy has to know the proto descriptor of
your gRPC service in order to the
transcoding.
$ protoc -I$(GOOGLEAPIS_DIR) -I. 
--include_imports 
--include_source_info 
--descriptor_set_out=proto.pb 
test/proto/bookstore.proto
proto_descriptor: “path/to/bin”
Setup Envoy Proxy (Cont.)
Proto Descriptor Path
proto_descriptor: “generated/file/path/proto.pb”
proto_descriptor_bin: Cr15ChVnb29nbGUvYXBpL2h0dHAucHJvdG8SCm...
Proto Descriptor Bin
$ cat proto.pb | openssl base64 -A
Encode proto descriptor using base64 encoding,
and set the value in yaml file
Start the Service
$ kubectl apply -f 
blog.yaml
Setup Gateway
$ kubectl apply -f 
blog-gateway.yaml
Setup Transcoder
$ kubectl apply -f 
blog-transcoder.yaml
Handle gRPC Request
Handle JSON Request
Deploying service using transcoding
Protocol Buffer Artifact Pipeline
Releasing new API version using Helm
API Changes Over Time
message Post {
int32 id = 1;
string title = 2;
string body = 3;
repeated string tags = 4;
google.protobuf.Timestamp created_at = 5;
}
Service spec changes over time
● Additional field to message, new RPC
● New package version
● Beware of backward incompatible changes!(renaming, changing type, removing field, …)
message Post {
int32 id = 1;
string title = 2;
string body = 3;
repeated string tags = 4;
google.protobuf.Timestamp created_at = 5;
string featured_image_url = 6;
}
Deploying EnvoyFilter
proto_descriptor should be updated whenever
protocol buffer is changed.
● proto_descriptor: expect *.pb descriptor
to exist on file system → volumeMount to
istio-proxy(sidecar) container
● proto_descriptor_bin: embed
base64-encoded *.pb descriptor content
directly into EnvoyFilter
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: blog-transcoder
namespace: blog
spec:
workloadLabels:
...
filters:
- listenerMatch:
listenerType: SIDECAR_INBOUND
filterName: envoy.grpc_json_transcoder
filterType: HTTP
filterConfig:
proto_descriptor: “blog.pb”
match_incoming_request_route: True
auto_mapping: False
services:
- blog.BlogService
Deploying EnvoyFilter (Cont.)
● proto_descriptor
○ Ensuring *.pb descriptor file is mounted to istio-proxy container is not easy
○ Automatic sidecar injection from istio-sidecar-injector is not dynamic
enough(mounted volume contains all pb descriptors)
○ Hard to control deployment timing
● proto_descriptor_bin
○ Lack of readability
○ No volume dependency
○ New transcoding configuration is applied as soon as EnvoyFilter is updated
Protocol Buffer Artifact Pipeline
Language-specific gRPC Artifacts should be created whenever API is updated
$ protoc -I (GOOGLE_APIS_DIR)
--python_out=..
--go_out=..
--js_out=..
./blog.proto
blog.proto
Private repository
Private pypi server
Private npm registry
+ rubygems, maven, ...Lint, Breaking Changes warning, ...
comment.
proto
user.proto
├── Jenkinsfile
├── Makefile
└── packages
├── blog
│ ├── blog.proto
│ └── package.json
└── user
├── user.proto
└── package.json
Mono Repository Approach
● Create CI pipeline that generates & publishes language-specific artifacts
● Common CI checks(lint, breaking changes warning) run for changed proto files
● Reduced boilerplate!
● Use lerna(node package) to bump versions of each API
Generating protobuf descriptor artifact:
protoc --include_imports
--include_source_info
--descriptor_set_out=blog.pb
Helm as Configuration Management Tool
Helm
● Already using helm for managing cluster-level services
(ingress controller, EFK, prometheus, grafana, …)
● Hosting private registry is easy(chartmuseum, object storage, ..)
● Easy CI pipeline setup
● CRDs can also be handled(VirtualService, EnvoyFilter, ...)
Helm Chart for gRPC Transcoding
apiVersion: apps/v1
kind: Deployment
metadata:
...
spec:
...
containers:
- name: {{ .Chart.Name }}
...
ports:
- name: grpc
containerPort: 9000
protocol: TCP
apiVersion: v1
kind: Service
metadata:
...
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: grpc
protocol: TCP
name: grpc
selector:
{{- include "blog.matchLabels" . | nindent 4 }}
Istio looks for port named grpc or any name prefixed with grpc-
Helm Chart for gRPC Transcoding
New Helm release will update
proto_descriptor_bin
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: {{ include "blog.fullname" . }}-transcoder
namespace: {{ .Release.Namespace }}
spec:
workloadLabels:
{{- include "blog.matchLabels" . | nindent 4 }}
filters:
- listenerMatch:
listenerType: SIDECAR_INBOUND
filterName: envoy.grpc_json_transcoder
filterType: HTTP
filterConfig:
proto_descriptor_bin: {{ .Values.protoDescriptorBin }}
match_incoming_request_route: True
auto_mapping: False
services:
- blog.v1.Blog
print_options:
always_print_primitive_fields: True
preserve_proto_field_names: True
Releasing New API Version
Using Helm CLI:
$ helm upgrade RELEASE -f values.prod.yaml -f
proto_descriptor.yaml --set image.tag=IMAGE_TAG repo/blog
Helm Chart
values.prod.yaml proto_descriptor.yaml
image:
tag: dkr.registry/blog:954ade7
secret:
DATABASE_URL: mysql://xx:yy@db:3306
WEB_CONCURRENCY: 5
proto_descriptor_bin: Cr15ChVnb29n
bGUvYXBpL2h0dHAucHJvdG...
*We internally use Spinnaker to deploy helm chart based services
● 503 status code is returned when requested to non-mapped path
● kubectl port-forward didn’t work for testing out REST APIs
● Arbitrary(non-JSON) message can be also supported by using
google.api.HttpBody
● grpc-status, grpc-message headers in response are useful when
debugging
Pitfalls & Tips
Conclusion
● It takes initial effort to build pipeline, but after then it becomes easy to
develop any gRPC service that supports JSON transcoding
● You can develop gRPC services while allowing other teams time to transition
● API-First approach becomes standard throughout the organization
● Over time, initial setup cost pays off
Resources
Sample Repo - https://github.com/Buzzvil/grpc-json-transcoding-example/
● https://medium.com/@ssowonny/grpc를-쓰면-rest가-공짜-19e3a6bed4a9
● https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/
grpc_json_transcoder_filter
● https://blog.envoyproxy.io/envoy-and-grpc-web-a-fresh-new-alternative-to-res
t-6504ce7eb880
● https://medium.com/google-cloud/grpc-transcoding-e101cc53d51d
● https://blog.jdriven.com/2018/11/transcoding-grpc-to-http-json-using-envoy/
● https://medium.com/building-ibotta/building-a-scaleable-protocol-buffers-grp
c-artifact-pipeline-5265c5118c9d
Thank You!
Sungwon Lee (Whale)
whale.lee@buzzvil.com
GitHub & Twitter @ssowonny
Hoseong Hwang (Liam)
liam.hwang@buzzvil.com
GitHub & Twitter @thefron
Running gRPC Services for Serving Legacy API on Kubernetes

More Related Content

What's hot

워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018
워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018
워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018Amazon Web Services Korea
 
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...Amazon Web Services Korea
 
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...confluent
 
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...Amazon Web Services Korea
 
Building Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaBuilding Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaGuido Schmutz
 
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략Open Source Consulting
 
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성Amazon Web Services Korea
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQAraf Karsh Hamid
 
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3Ahmed Misbah
 
Exposing services with Azure API Management
Exposing services with Azure API ManagementExposing services with Azure API Management
Exposing services with Azure API ManagementCallon Campbell
 
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)Open Source Consulting
 
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안Amazon Web Services Korea
 
Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafkaconfluent
 
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Amazon Web Services
 
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63Angel Alberici
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaArvind Kumar G.S
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드confluent
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafkamarius_bogoevici
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREAraf Karsh Hamid
 

What's hot (20)

워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018
워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018
워크플로우 기반의 AWS 미디어서비스 활용하기::이상오::AWS Summit Seoul 2018
 
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
 
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...
Simplifying Distributed Transactions with Sagas in Kafka (Stephen Zoio, Simpl...
 
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
효과적인 NoSQL (Elasticahe / DynamoDB) 디자인 및 활용 방안 (최유정 & 최홍식, AWS 솔루션즈 아키텍트) :: ...
 
Building Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache KafkaBuilding Event Driven (Micro)services with Apache Kafka
Building Event Driven (Micro)services with Apache Kafka
 
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략
클라우드 네이티브 전환 요소 및 성공적인 쿠버네티스 도입 전략
 
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성
AWS Summit Seoul 2023 | AWS에서 최소한의 비용으로 구현하는 멀티리전 DR 자동화 구성
 
Event Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQEvent Sourcing & CQRS, Kafka, Rabbit MQ
Event Sourcing & CQRS, Kafka, Rabbit MQ
 
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3
Istio as an Enabler for Migrating Monolithic Applications to Microservices v1.3
 
Exposing services with Azure API Management
Exposing services with Azure API ManagementExposing services with Azure API Management
Exposing services with Azure API Management
 
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)[오픈소스컨설팅] 서비스 메쉬(Service mesh)
[오픈소스컨설팅] 서비스 메쉬(Service mesh)
 
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안
[2017 Windows on AWS] AWS를 활용한 그룹웨어 구축 방안
 
Distributed stream processing with Apache Kafka
Distributed stream processing with Apache KafkaDistributed stream processing with Apache Kafka
Distributed stream processing with Apache Kafka
 
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
Deep Dive on Accelerating Content, APIs, and Applications with Amazon CloudFr...
 
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
MuleSoft Event Driven Architecture (EDA Patterns in MuleSoft) - VirtualMuleys63
 
Monitoring using Prometheus and Grafana
Monitoring using Prometheus and GrafanaMonitoring using Prometheus and Grafana
Monitoring using Prometheus and Grafana
 
Anthos
AnthosAnthos
Anthos
 
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
Confluent Workshop Series: ksqlDB로 스트리밍 앱 빌드
 
Developing real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and KafkaDeveloping real-time data pipelines with Spring and Kafka
Developing real-time data pipelines with Spring and Kafka
 
Microservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SREMicroservices Docker Kubernetes Istio Kanban DevOps SRE
Microservices Docker Kubernetes Istio Kanban DevOps SRE
 

Similar to Running gRPC Services for Serving Legacy API on Kubernetes

Driving containerd operations with gRPC
Driving containerd operations with gRPCDriving containerd operations with gRPC
Driving containerd operations with gRPCDocker, Inc.
 
Deep Dive into SpaceONE
Deep Dive into SpaceONEDeep Dive into SpaceONE
Deep Dive into SpaceONEChoonho Son
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to KubernetesPaul Czarkowski
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tourStefan Schimanski
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewMaría Angélica Bracho
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCTim Burks
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Tim Burks
 
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...KubeAcademy
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleTim Burks
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Maarten Mulders
 
From System Engineer to Gopher
From System Engineer to GopherFrom System Engineer to Gopher
From System Engineer to GopherI-Fan Wang
 
Creating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesPaul Goldbaum
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinItb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinGavin Pickin
 
Going FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixGoing FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixYunong Xiao
 
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSElad Hirsch
 

Similar to Running gRPC Services for Serving Legacy API on Kubernetes (20)

Driving containerd operations with gRPC
Driving containerd operations with gRPCDriving containerd operations with gRPC
Driving containerd operations with gRPC
 
Deep Dive into SpaceONE
Deep Dive into SpaceONEDeep Dive into SpaceONE
Deep Dive into SpaceONE
 
Ingress overview
Ingress overviewIngress overview
Ingress overview
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Kubernetes API code-base tour
Kubernetes API code-base tourKubernetes API code-base tour
Kubernetes API code-base tour
 
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
apidays LIVE Helsinki - Implementing OpenAPI and GraphQL Services with gRPC b...
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless OverviewOpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
OpenShift Meetup - Tokyo - Service Mesh and Serverless Overview
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)
 
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
KubeCon EU 2016: Creating an Advanced Load Balancing Solution for Kubernetes ...
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at Google
 
SVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApiSVQdotNET: Building APIs with OpenApi
SVQdotNET: Building APIs with OpenApi
 
Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)Mastering Microservices with Kong (DevoxxUK 2019)
Mastering Microservices with Kong (DevoxxUK 2019)
 
From System Engineer to Gopher
From System Engineer to GopherFrom System Engineer to Gopher
From System Engineer to Gopher
 
Creating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and Kubernetes
 
Itb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin PickinItb 2021 - Bulding Quick APIs by Gavin Pickin
Itb 2021 - Bulding Quick APIs by Gavin Pickin
 
Going FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at NetflixGoing FaaSter, Functions as a Service at Netflix
Going FaaSter, Functions as a Service at Netflix
 
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADSKNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
KNATIVE - DEPLOY, AND MANAGE MODERN CONTAINER-BASED SERVERLESS WORKLOADS
 

Recently uploaded

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 

Recently uploaded (20)

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

Running gRPC Services for Serving Legacy API on Kubernetes

  • 1.
  • 2. Running gRPC Services for Serving Legacy RESTful API on Kubernetes
  • 3. Who We Are Sungwon Lee / Whale Buzzvil Chief Architect Hoseong Hwang / Liam Buzzvil DevOps Lead
  • 4. Why? Why did we choose gRPC? Why do we still need to support REST API?
  • 5. Why microservices architecture? There are so many domains and stakeholders in ad-tech industry.
  • 6. Why gRPC? Performance matters Multiple services increases network latency Ad request should be done within 100ms API-first Approach Need to support polyglot IDL(Interface Definition Language) required
  • 7. gRPC is great, but.. We still need to support legacy RESTful JSON API There are partners using the legacy APIs REST APIs: mostly beloved API protocol B2B business
  • 8. Support both gRPC/REST protocols Build a server for transcoding? gRPC ServerREST JSON Transcoding server Client Expensive maintenance cost 1. Parse JSON request 2. Transform JSON to gRPC Request 3. Send request to gRPC Server 4. Transcode gRPC response to JSON format 5. Send a response to the client It seems familiar!
  • 9. Istio Service Mesh Moving to Microservices Micoservices grow in size and complexity Difficult to understand and manage Service Mesh Detach network logic from business logic Monolythic Microservice Microservice Proxy Microservice Proxy
  • 11.
  • 12. Let’s Try It ! Setup Protobuf for Custom Routes Setup Istio/EnvoyFilter for gRPC JSON transcoder
  • 13. Setup Protocol Buffers service CalendarApi { rpc ListEvents(ListEventsRequest) returns (ListEventsResponse); // ... } The easiest way: Do nothing. Transcoder will handle it automatically.
  • 14. Setup Protocol Buffers (Cont.) package buzzvil.calendar.v1; service CalendarApi { rpc ListEvents(ListEventsRequest) returns (ListEventsResponse); } $ curl -X POST https://host.here/buzzvil.calendar.v1.CalendarApi/ListEvents = POST /<package>.<service>/<method>
  • 15. Setup Protocol Buffers (Cont.) package buzzvil.calendar.v1; service CalendarApi { rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) { option (google.api.http) = { get: "/v1/events" }; } } Custom routes: google.api.http annotation $ curl -X GET https://host.here/v1/events
  • 16. Setup Protocol Buffers (Cont.) Parameters service CalendarApi { rpc UpdateEvent(UpdateEventRequest) returns (Event) { option (google.api.http) = { put: "/v1/events/{event.id}", body: "event" }; } } message Event { int64 id = 1; string name = 2; } message UpdateEventRequest { Event event = 1; }
  • 17. Setup Envoy Proxy Let’s try Istio / EnvoyFilter to setup envoy sidecar proxy
  • 18. Setup Envoy Proxy (Cont.) apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: example-transcoder namespace: example-namespace spec: workloadLabels: ... filters: - listenerMatch: listenerType: SIDECAR_INBOUND filterName: envoy.grpc_json_transcoder filterType: HTTP filterConfig: proto_descriptor: “path/to/bin” match_incoming_request_route: True auto_mapping: False services: - buzzvil.calendar.v1.CalendarApi filterName: envoy.grpc_json_transcoder match_incoming_request_route: True Services: - buzzvil.calendar.v1.CalendarApi Apply grpc_json_transcoder filter to the services Use the specified route
  • 19. Setup Envoy Proxy (Cont.) apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: example-transcoder namespace: example-namespace spec: workloadLabels: ... filters: - listenerMatch: listenerType: SIDECAR_INBOUND filterName: envoy.grpc_json_transcoder filterType: HTTP filterConfig: proto_descriptor: “path/to/bin” match_incoming_request_route: True auto_mapping: False services: - buzzvil.calendar.v1.CalendarApi Proto Descriptor Envoy has to know the proto descriptor of your gRPC service in order to the transcoding. $ protoc -I$(GOOGLEAPIS_DIR) -I. --include_imports --include_source_info --descriptor_set_out=proto.pb test/proto/bookstore.proto proto_descriptor: “path/to/bin”
  • 20. Setup Envoy Proxy (Cont.) Proto Descriptor Path proto_descriptor: “generated/file/path/proto.pb” proto_descriptor_bin: Cr15ChVnb29nbGUvYXBpL2h0dHAucHJvdG8SCm... Proto Descriptor Bin $ cat proto.pb | openssl base64 -A Encode proto descriptor using base64 encoding, and set the value in yaml file
  • 21. Start the Service $ kubectl apply -f blog.yaml
  • 22. Setup Gateway $ kubectl apply -f blog-gateway.yaml
  • 23. Setup Transcoder $ kubectl apply -f blog-transcoder.yaml
  • 26. Deploying service using transcoding Protocol Buffer Artifact Pipeline Releasing new API version using Helm
  • 27. API Changes Over Time message Post { int32 id = 1; string title = 2; string body = 3; repeated string tags = 4; google.protobuf.Timestamp created_at = 5; } Service spec changes over time ● Additional field to message, new RPC ● New package version ● Beware of backward incompatible changes!(renaming, changing type, removing field, …) message Post { int32 id = 1; string title = 2; string body = 3; repeated string tags = 4; google.protobuf.Timestamp created_at = 5; string featured_image_url = 6; }
  • 28. Deploying EnvoyFilter proto_descriptor should be updated whenever protocol buffer is changed. ● proto_descriptor: expect *.pb descriptor to exist on file system → volumeMount to istio-proxy(sidecar) container ● proto_descriptor_bin: embed base64-encoded *.pb descriptor content directly into EnvoyFilter apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: blog-transcoder namespace: blog spec: workloadLabels: ... filters: - listenerMatch: listenerType: SIDECAR_INBOUND filterName: envoy.grpc_json_transcoder filterType: HTTP filterConfig: proto_descriptor: “blog.pb” match_incoming_request_route: True auto_mapping: False services: - blog.BlogService
  • 29. Deploying EnvoyFilter (Cont.) ● proto_descriptor ○ Ensuring *.pb descriptor file is mounted to istio-proxy container is not easy ○ Automatic sidecar injection from istio-sidecar-injector is not dynamic enough(mounted volume contains all pb descriptors) ○ Hard to control deployment timing ● proto_descriptor_bin ○ Lack of readability ○ No volume dependency ○ New transcoding configuration is applied as soon as EnvoyFilter is updated
  • 30. Protocol Buffer Artifact Pipeline Language-specific gRPC Artifacts should be created whenever API is updated $ protoc -I (GOOGLE_APIS_DIR) --python_out=.. --go_out=.. --js_out=.. ./blog.proto blog.proto Private repository Private pypi server Private npm registry + rubygems, maven, ...Lint, Breaking Changes warning, ... comment. proto user.proto
  • 31. ├── Jenkinsfile ├── Makefile └── packages ├── blog │ ├── blog.proto │ └── package.json └── user ├── user.proto └── package.json Mono Repository Approach ● Create CI pipeline that generates & publishes language-specific artifacts ● Common CI checks(lint, breaking changes warning) run for changed proto files ● Reduced boilerplate! ● Use lerna(node package) to bump versions of each API Generating protobuf descriptor artifact: protoc --include_imports --include_source_info --descriptor_set_out=blog.pb
  • 32. Helm as Configuration Management Tool Helm ● Already using helm for managing cluster-level services (ingress controller, EFK, prometheus, grafana, …) ● Hosting private registry is easy(chartmuseum, object storage, ..) ● Easy CI pipeline setup ● CRDs can also be handled(VirtualService, EnvoyFilter, ...)
  • 33. Helm Chart for gRPC Transcoding apiVersion: apps/v1 kind: Deployment metadata: ... spec: ... containers: - name: {{ .Chart.Name }} ... ports: - name: grpc containerPort: 9000 protocol: TCP apiVersion: v1 kind: Service metadata: ... spec: type: {{ .Values.service.type }} ports: - port: {{ .Values.service.port }} targetPort: grpc protocol: TCP name: grpc selector: {{- include "blog.matchLabels" . | nindent 4 }} Istio looks for port named grpc or any name prefixed with grpc-
  • 34. Helm Chart for gRPC Transcoding New Helm release will update proto_descriptor_bin apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: {{ include "blog.fullname" . }}-transcoder namespace: {{ .Release.Namespace }} spec: workloadLabels: {{- include "blog.matchLabels" . | nindent 4 }} filters: - listenerMatch: listenerType: SIDECAR_INBOUND filterName: envoy.grpc_json_transcoder filterType: HTTP filterConfig: proto_descriptor_bin: {{ .Values.protoDescriptorBin }} match_incoming_request_route: True auto_mapping: False services: - blog.v1.Blog print_options: always_print_primitive_fields: True preserve_proto_field_names: True
  • 35. Releasing New API Version Using Helm CLI: $ helm upgrade RELEASE -f values.prod.yaml -f proto_descriptor.yaml --set image.tag=IMAGE_TAG repo/blog Helm Chart values.prod.yaml proto_descriptor.yaml image: tag: dkr.registry/blog:954ade7 secret: DATABASE_URL: mysql://xx:yy@db:3306 WEB_CONCURRENCY: 5 proto_descriptor_bin: Cr15ChVnb29n bGUvYXBpL2h0dHAucHJvdG... *We internally use Spinnaker to deploy helm chart based services
  • 36. ● 503 status code is returned when requested to non-mapped path ● kubectl port-forward didn’t work for testing out REST APIs ● Arbitrary(non-JSON) message can be also supported by using google.api.HttpBody ● grpc-status, grpc-message headers in response are useful when debugging Pitfalls & Tips
  • 37. Conclusion ● It takes initial effort to build pipeline, but after then it becomes easy to develop any gRPC service that supports JSON transcoding ● You can develop gRPC services while allowing other teams time to transition ● API-First approach becomes standard throughout the organization ● Over time, initial setup cost pays off
  • 38. Resources Sample Repo - https://github.com/Buzzvil/grpc-json-transcoding-example/ ● https://medium.com/@ssowonny/grpc를-쓰면-rest가-공짜-19e3a6bed4a9 ● https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/ grpc_json_transcoder_filter ● https://blog.envoyproxy.io/envoy-and-grpc-web-a-fresh-new-alternative-to-res t-6504ce7eb880 ● https://medium.com/google-cloud/grpc-transcoding-e101cc53d51d ● https://blog.jdriven.com/2018/11/transcoding-grpc-to-http-json-using-envoy/ ● https://medium.com/building-ibotta/building-a-scaleable-protocol-buffers-grp c-artifact-pipeline-5265c5118c9d
  • 39. Thank You! Sungwon Lee (Whale) whale.lee@buzzvil.com GitHub & Twitter @ssowonny Hoseong Hwang (Liam) liam.hwang@buzzvil.com GitHub & Twitter @thefron