Feedback

Chat Icon

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Deploying Stateless Microservices: Introduction
21%

Creating the Deployment

To deploy our Flask container, we need to create a Deployment. Start by exporting your Docker Hub username:

export DOCKERHUB_USERNAME=

Then, create a file named deployment.yaml in the kubernetes folder with the following content:

cat << EOF > kubernetes/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: stateless-flask
  namespace: stateless-flask
spec:
  replicas: 3
  selector:
    matchLabels:
      app: stateless-flask
  template:
    metadata:
      labels:
        app: stateless-flask
    spec:
      containers:
      - name: stateless-flask
        image: $DOCKERHUB_USERNAME/stateless-flask:v0
        ports:

Cloud-Native Microservices With Kubernetes - 2nd Edition

A Comprehensive Guide to Building, Scaling, Deploying, Observing, and Managing Highly-Available Microservices in Kubernetes

Enroll now to unlock all content and receive all future updates for free.