<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          flask-vue-kubernetesFlask + Vue + Postgres + Docker + Kubernetes

          聯(lián)合創(chuàng)作 · 2023-09-27 08:40

          Running Flask on Kubernetes

          Want to learn how to build this?

          Check out the post.

          Want to use this project?

          Docker

          Build the images and spin up the containers:

          $ docker-compose up -d --build

          Run the migrations and seed the database:

          $ docker-compose exec server python manage.py recreate_db
          $ docker-compose exec server python manage.py seed_db

          Test it out at:

          1. http://localhost:8080/
          2. http://localhost:5001/books/ping
          3. http://localhost:5001/books

          Kubernetes

          Minikube

          Install and run Minikube:

          1. Install a Hypervisor (like VirtualBox or HyperKit) to manage virtual machines
          2. Install and Set Up kubectl to deploy and manage apps on Kubernetes
          3. Install Minikube

          Start the cluster:

          $ minikube start --vm-driver=virtualbox
          $ minikube dashboard

          Volume

          Create the volume:

          $ kubectl apply -f ./kubernetes/persistent-volume.yml

          Create the volume claim:

          $ kubectl apply -f ./kubernetes/persistent-volume-claim.yml

          Secrets

          Create the secret object:

          $ kubectl apply -f ./kubernetes/secret.yml

          Postgres

          Create deployment:

          $ kubectl create -f ./kubernetes/postgres-deployment.yml

          Create the service:

          $ kubectl create -f ./kubernetes/postgres-service.yml

          Create the database:

          $ kubectl get pods
          $ kubectl exec postgres-<POD_IDENTIFIER> --stdin --tty -- createdb -U postgres books

          Flask

          Build and push the image to Docker Hub:

          $ docker build -t mjhea0/flask-kubernetes ./services/server
          $ docker push mjhea0/flask-kubernetes

          Make sure to replace mjhea0 with your Docker Hub namespace in the above commands as well as in kubernetes/flask-deployment.yml

          Create the deployment:

          $ kubectl create -f ./kubernetes/flask-deployment.yml

          Create the service:

          $ kubectl create -f ./kubernetes/flask-service.yml

          Apply the migrations and seed the database:

          $ kubectl get pods
          $ kubectl exec flask-<POD_IDENTIFIER> --stdin --tty -- python manage.py recreate_db
          $ kubectl exec flask-<POD_IDENTIFIER> --stdin --tty -- python manage.py seed_db

          Ingress

          Enable and apply:

          $ minikube addons enable ingress
          $ kubectl apply -f ./kubernetes/minikube-ingress.yml

          Add entry to /etc/hosts file:

          <MINIKUBE_IP> hello.world
          

          Try it out:

          1. http://hello.world/books/ping
          2. http://hello.world/books

          Vue

          Build and push the image to Docker Hub:

          $ docker build -t mjhea0/vue-kubernetes ./services/client \
              -f ./services/client/Dockerfile-minikube
          
          $ docker push mjhea0/vue-kubernetes

          Again, replace mjhea0 with your Docker Hub namespace in the above commands as well as in kubernetes/vue-deployment.yml

          Create the deployment:

          $ kubectl create -f ./kubernetes/vue-deployment.yml

          Create the service:

          $ kubectl create -f ./kubernetes/vue-service.yml

          Try it out at http://hello.world/.

          瀏覽 8
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  色噜噜网站 | 亚洲欧美内射 | 男女h网站 | 竹菊影视一区二区三区四区 | 美女被暴草视频在线看 |