Deployment of a Serverless Media Function

Jonas Rydholm Birmé, Streaming Video Specialist, Eyevinn Technology

What is Kubernetes?

Media Function Pod

apiVersion: v1
kind: Pod
metadata:
name: function-probe
labels:
app: function-probe
spec:
containers:
- name: function-probe
image: function-probe:0.1.0
ports:
- containerPort: 8080
protocol: TCP
$ kubectl apply -f pod.yaml
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
function-probe 1/1 Running 0 2m8s
$ kubectl port-forward media-function-probe 8080:8080
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
11a9777508b8 2323f847dee3 "npm start" 5 minutes ago Up 5 minutes k8s_function-probe_function-probe_default_cef1dd27-2e51-11ea-b11f-025000000001_0
$ kubectl delete -f pod.yaml

Media Function Controller

apiVersion: apps/v1
kind: Deployment
metadata:
name: function-probe-deployment
labels:
app: function-probe
spec:
replicas: 2
selector:
matchLabels:
app: function-probe
template:
metadata:
labels:
app: function-probe
spec:
containers:
- name: function-probe
image: function-probe:0.1.0
ports:
- containerPort: 8080
protocol: TCP
$ kubectl apply -f deployment.yaml
deployment.apps/function-probe-deployment created
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
function-probe-deployment-767fd65bc7-jr8cl 1/1 Running 0 34s
function-probe-deployment-767fd65bc7-scvg5 1/1 Running 0 34s
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
function-probe-deployment 2/2 2 2 13m

spec:
containers:
- name: function-probe
image: function-probe:0.1.1

Media Function Service

apiVersion: v1
kind: Service
metadata:
name: media-function-probe
spec:
type: NodePort
selector:
app: function-probe
ports:
- port: 8080
nodePort: 30000
protocol: TCP
name: http
$ kubectl apply -f service.yaml
service/media-function-probe created
$ kubectl describe svc media-function-probe

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store