import%20marimo%0A%0A__generated_with%20%3D%20%220.18.3%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0Awith%20app.setup%3A%0A%20%20%20%20%23%20Initialization%20code%20that%20runs%20before%20all%20other%20cells%0A%20%20%20%20pass%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Machine%20Learning%20Zoomcamp%0A%0A%20%20%20%20%23%23%20Module%2010%3A%20**Deploying%20with%20Kubernetes**%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Homework%0A%0A%20%20%20%20In%20this%20homework%2C%20we'll%20deploy%20the%20lead%20scoring%20model%20from%20the%20homework%205.%0A%0A%20%20%20%20We%20already%20have%20a%20docker%20image%20for%20this%20model%20-%20we'll%20use%20it%20for%0A%20%20%20%20deploying%20the%20model%20to%20Kubernetes.%0A%0A%0A%20%20%20%20%23%23%20Building%20the%20image%0A%0A%20%20%20%20Clone%20the%20course%20repo%20if%20you%20haven't%3A%0A%0A%20%20%20%20%60%60%60%0A%20%20%20%20git%20clone%20https%3A%2F%2Fgithub.com%2FDataTalksClub%2Fmachine-learning-zoomcamp.git%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Go%20to%20the%20%60course-zoomcamp%2Fcohorts%2F2025%2F05-deployment%2Fhomework%60%20folder%20and%0A%20%20%20%20execute%20the%20following%3A%0A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20docker%20build%20-f%20Dockerfile_full%20-t%20zoomcamp-model%3A3.13.10-hw10%20.%0A%20%20%20%20%60%60%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%201%0A%0A%20%20%20%20Run%20it%20to%20test%20that%20it's%20working%20locally%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20docker%20run%20-it%20--rm%20-p%209696%3A9696%20zoomcamp-model%3A3.13.10-hw10%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20And%20in%20another%20terminal%2C%20execute%20%60q6_test.py%60%20file%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20python%20q6_test.py%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20You%20should%20see%20this%3A%0A%0A%20%20%20%20%60%60%60python%0A%20%20%20%20%7B'conversion_probability'%3A%20%3Cvalue%3E%2C%20'conversion'%3A%20False%7D%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Here%20%60%3Cvalue%3E%60%20is%20the%20probability%20of%20getting%20a%20subscription.%20You%20need%20to%20choose%20the%20right%20one.%0A%0A%20%20%20%20*%200.29%0A%20%20%20%20*%200.49%0A%20%20%20%20*%200.69%0A%20%20%20%20*%200.89%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20response%20was%3A%0A%0A%20%20%20%20%60%60%60python%0A%20%20%20%20%7B'conversion_probability'%3A%200.49999999999842815%2C%20'conversion'%3A%20False%7D%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20So%20the%20answer%20is%20**0.49**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Now%20you%20can%20stop%20the%20container%20running%20in%20Docker.%0A%0A%0A%20%20%20%20%23%23%20Installing%20%60kubectl%60%20and%20%60kind%60%0A%0A%20%20%20%20You%20need%20to%20install%3A%0A%0A%20%20%20%20*%20%60kubectl%60%20-%20https%3A%2F%2Fkubernetes.io%2Fdocs%2Ftasks%2Ftools%2F%20(you%20might%20already%20have%20it%20-%20check%20before%20installing)%0A%20%20%20%20*%20%60kind%60%20-%20https%3A%2F%2Fkind.sigs.k8s.io%2Fdocs%2Fuser%2Fquick-start%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%202%0A%0A%20%20%20%20What's%20the%20version%20of%20%60kind%60%20that%20you%20have%3F%0A%0A%20%20%20%20Use%20%60kind%20--version%60%20to%20find%20out.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20answer%20was%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kind%20version%200.30.0%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20So%20the%20answer%20is%20**0.30.0**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Creating%20a%20cluster%0A%0A%20%20%20%20Now%20let's%20create%20a%20cluster%20with%20%60kind%60%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kind%20create%20cluster%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20And%20check%20with%20%60kubectl%60%20that%20it%20was%20successfully%20created%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kubectl%20cluster-info%0A%20%20%20%20%60%60%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%203%0A%0A%20%20%20%20What's%20the%20smallest%20deployable%20computing%20unit%20that%20we%20can%20create%20and%20manage%0A%20%20%20%20in%20Kubernetes%20(%60kind%60%20in%20our%20case)%3F%0A%0A%20%20%20%20*%20Node%0A%20%20%20%20*%20Pod%0A%20%20%20%20*%20Deployment%0A%20%20%20%20*%20Service%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20smallest%20deployable%20computing%20unit%20is%20the%20**Pod**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%204%0A%0A%20%20%20%20Now%20let's%20test%20if%20everything%20works.%20Use%20%60kubectl%60%20to%20get%20the%20list%20of%20running%20services.%0A%0A%20%20%20%20What's%20the%20%60Type%60%20of%20the%20service%20that%20is%20already%20running%20there%3F%0A%0A%20%20%20%20*%20NodePort%0A%20%20%20%20*%20ClusterIP%0A%20%20%20%20*%20ExternalName%0A%20%20%20%20*%20LoadBalancer%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20executed%20command%20was%20%60kubectl%20get%20services%60%20and%20its%20output%20was%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20NAME%20%20%20%20%20%20%20%20%20TYPE%20%20%20%20%20%20%20%20CLUSTER-IP%20%20%20EXTERNAL-IP%20%20%20PORT(S)%20%20%20AGE%0A%20%20%20%20kubernetes%20%20%20ClusterIP%20%20%2010.96.0.1%20%20%20%20%3Cnone%3E%20%20%20%20%20%20%20%20443%2FTCP%20%20%204m29s%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20So%20the%20answer%20is%20**ClusterIP**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%205%0A%0A%20%20%20%20To%20be%20able%20to%20use%20the%20docker%20image%20we%20previously%20created%20(%60zoomcamp-model%3A3.13.10-hw10%60)%2C%0A%20%20%20%20we%20need%20to%20register%20it%20with%20%60kind%60.%0A%0A%20%20%20%20What's%20the%20command%20we%20need%20to%20run%20for%20that%3F%0A%0A%20%20%20%20*%20%60kind%20create%20cluster%60%0A%20%20%20%20*%20%60kind%20build%20node-image%60%0A%20%20%20%20*%20%60kind%20load%20docker-image%60%0A%20%20%20%20*%20%60kubectl%20apply%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20command%20to%20register%20the%20docker%20image%20with%20**kind**%20is%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kind%20load%20docker-image%20zoomcamp-model%3A3.13.10-hw10%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20So%20the%20answer%20is%20**kind%20load%20docker-image**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%206%0A%0A%20%20%20%20Now%20let's%20create%20a%20deployment%20config%20(e.g.%20%60deployment.yaml%60)%3A%0A%0A%20%20%20%20%60%60%60yaml%0A%20%20%20%20apiVersion%3A%20apps%2Fv1%0A%20%20%20%20kind%3A%20Deployment%0A%20%20%20%20metadata%3A%0A%20%20%20%20%20%20name%3A%20subscription%0A%20%20%20%20spec%3A%0A%20%20%20%20%20%20selector%3A%0A%20%20%20%20%20%20%20%20matchLabels%3A%0A%20%20%20%20%20%20%20%20%20%20app%3A%20subscription%0A%20%20%20%20%20%20replicas%3A%201%0A%20%20%20%20%20%20template%3A%0A%20%20%20%20%20%20%20%20metadata%3A%0A%20%20%20%20%20%20%20%20%20%20labels%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20app%3A%20subscription%0A%20%20%20%20%20%20%20%20spec%3A%0A%20%20%20%20%20%20%20%20%20%20containers%3A%0A%20%20%20%20%20%20%20%20%20%20-%20name%3A%20subscription%0A%20%20%20%20%20%20%20%20%20%20%20%20image%3A%20%3CImage%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20resources%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20requests%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20memory%3A%20%2264Mi%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cpu%3A%20%22100m%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20limits%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20memory%3A%20%3CMemory%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cpu%3A%20%3CCPU%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20ports%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20-%20containerPort%3A%20%3CPort%3E%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Replace%20%60%3CImage%3E%60%2C%20%60%3CMemory%3E%60%2C%20%60%3CCPU%3E%60%2C%20%60%3CPort%3E%60%20with%20the%20correct%20values.%0A%0A%20%20%20%20What%20is%20the%20value%20for%20%60%3CPort%3E%60%3F%0A%0A%20%20%20%20Apply%20this%20deployment%20using%20the%20appropriate%20command%20and%20get%20a%20list%20of%20running%20Pods.%0A%20%20%20%20You%20can%20see%20one%20running%20Pod.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20value%20for%20%60%3CPort%3E%60%20is%20**9696**%20and%20our%20final%20YAML%20is%3A%0A%0A%20%20%20%20%60%60%60yaml%0A%20%20%20%20apiVersion%3A%20apps%2Fv1%0A%20%20%20%20kind%3A%20Deployment%0A%20%20%20%20metadata%3A%0A%20%20%20%20%20%20name%3A%20subscription%0A%20%20%20%20spec%3A%0A%20%20%20%20%20%20selector%3A%0A%20%20%20%20%20%20%20%20matchLabels%3A%0A%20%20%20%20%20%20%20%20%20%20app%3A%20subscription%0A%20%20%20%20%20%20replicas%3A%201%0A%20%20%20%20%20%20template%3A%0A%20%20%20%20%20%20%20%20metadata%3A%0A%20%20%20%20%20%20%20%20%20%20labels%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20app%3A%20subscription%0A%20%20%20%20%20%20%20%20spec%3A%0A%20%20%20%20%20%20%20%20%20%20containers%3A%0A%20%20%20%20%20%20%20%20%20%20-%20name%3A%20subscription%0A%20%20%20%20%20%20%20%20%20%20%20%20image%3A%20zoomcamp-model%3A3.13.10-hw10%0A%20%20%20%20%20%20%20%20%20%20%20%20resources%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20requests%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20memory%3A%20%2264Mi%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cpu%3A%20%22100m%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20limits%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20memory%3A%20%22128Mi%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cpu%3A%20%22500m%22%0A%20%20%20%20%20%20%20%20%20%20%20%20ports%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20-%20containerPort%3A%209696%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20To%20apply%20it%20and%20then%20check%20the%20list%20of%20running%20services%20we%20used%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kubectl%20apply%20-f%20deployment.yml%0A%0A%20%20%20%20kubectl%20get%20deployments%0A%0A%20%20%20%20%23%20NAME%20%20%20%20%20%20%20%20%20%20%20READY%20%20%20UP-TO-DATE%20%20%20AVAILABLE%20%20%20AGE%0A%20%20%20%20%23%20subscription%20%20%201%2F1%20%20%20%20%201%20%20%20%20%20%20%20%20%20%20%20%201%20%20%20%20%20%20%20%20%20%20%2095s%0A%0A%20%20%20%20kubectl%20get%20pods%0A%0A%20%20%20%20%23%20NAME%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20READY%20%20%20STATUS%20%20%20%20RESTARTS%20%20%20AGE%0A%20%20%20%20%23%20subscription-69c87b4597-ncxnb%20%20%201%2F1%20%20%20%20%20Running%20%20%200%20%20%20%20%20%20%20%20%20%2095s%0A%20%20%20%20%60%60%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%207%0A%0A%20%20%20%20Let's%20create%20a%20service%20for%20this%20deployment%20(%60service.yaml%60)%3A%0A%0A%20%20%20%20%60%60%60yaml%0A%20%20%20%20apiVersion%3A%20v1%0A%20%20%20%20kind%3A%20Service%0A%20%20%20%20metadata%3A%0A%20%20%20%20%20%20name%3A%20%3CService%20name%3E%0A%20%20%20%20spec%3A%0A%20%20%20%20%20%20type%3A%20LoadBalancer%0A%20%20%20%20%20%20selector%3A%0A%20%20%20%20%20%20%20%20app%3A%20%3C%3F%3F%3F%3E%0A%20%20%20%20%20%20ports%3A%0A%20%20%20%20%20%20-%20port%3A%2080%0A%20%20%20%20%20%20%20%20targetPort%3A%20%3CPORT%3E%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Fill%20it%20in.%20What%20do%20we%20need%20to%20write%20instead%20of%20%60%3C%3F%3F%3F%3E%60%3F%0A%0A%20%20%20%20Apply%20this%20config%20file.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20value%20for%20the%20selector%20should%20be%20**subscription**%20so%20our%20YAML%20would%20look%20like%20this%3A%0A%0A%20%20%20%20%60%60%60yaml%0A%20%20%20%20apiVersion%3A%20v1%0A%20%20%20%20kind%3A%20Service%0A%20%20%20%20metadata%3A%0A%20%20%20%20%20%20name%3A%20subscription%0A%20%20%20%20spec%3A%0A%20%20%20%20%20%20type%3A%20LoadBalancer%0A%20%20%20%20%20%20selector%3A%0A%20%20%20%20%20%20%20%20app%3A%20subscription%0A%20%20%20%20%20%20ports%3A%0A%20%20%20%20%20%20-%20protocol%3A%20TCP%0A%20%20%20%20%20%20%20%20port%3A%2080%0A%20%20%20%20%20%20%20%20targetPort%3A%209696%0A%20%20%20%20%60%60%60%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Testing%20the%20service%0A%0A%20%20%20%20We%20can%20test%20our%20service%20locally%20by%20forwarding%20the%20port%209696%20on%20our%20computer%0A%20%20%20%20to%20the%20port%2080%20on%20the%20service%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kubectl%20port-forward%20service%2F%3CService%20name%3E%209696%3A80%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Run%20%60q6_test.py%60%20(from%20the%20homework%205)%20once%20again%20to%20verify%20that%20everything%20is%20working.%0A%20%20%20%20You%20should%20get%20the%20same%20result%20as%20in%20Question%201.%0A%0A%0A%20%20%20%20%23%23%20Autoscaling%0A%0A%20%20%20%20Now%20we're%20going%20to%20use%20a%20%5BHorizontalPodAutoscaler%5D(https%3A%2F%2Fkubernetes.io%2Fdocs%2Ftasks%2Frun-application%2Fhorizontal-pod-autoscale-walkthrough%2F)%0A%20%20%20%20(HPA%20for%20short)%20that%20automatically%20updates%20a%20workload%20resource%20(such%20as%20our%20deployment)%2C%0A%20%20%20%20with%20the%20aim%20of%20automatically%20scaling%20the%20workload%20to%20match%20demand.%0A%0A%20%20%20%20Use%20the%20following%20command%20to%20create%20the%20HPA%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kubectl%20autoscale%20deployment%20subscription%20--name%20subscription-hpa%20--cpu-percent%3D20%20--min%3D1%20--max%3D3%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20You%20can%20check%20the%20current%20status%20of%20the%20new%20HPA%20by%20running%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20kubectl%20get%20hpa%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20The%20output%20should%20be%20similar%20to%20the%20next%3A%0A%0A%20%20%20%20%60%60%60bash%0A%20%20%20%20NAME%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20REFERENCE%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TARGETS%20%20%20MINPODS%20%20%20MAXPODS%20%20%20REPLICAS%20%20%20AGE%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%201%25%2F20%25%20%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%201%20%20%20%20%20%20%20%20%20%2027s%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20%60TARGET%60%20column%20shows%20the%20average%20CPU%20consumption%20across%20all%20the%20Pods%20controlled%20by%20the%20corresponding%20deployment.%0A%20%20%20%20Current%20CPU%20consumption%20is%20about%200%25%20as%20there%20are%20no%20clients%20sending%20requests%20to%20the%20server.%0A%20%20%20%20%3E%0A%20%20%20%20%3ENote%3A%20In%20case%20the%20HPA%20instance%20doesn't%20run%20properly%2C%20try%20to%20install%20the%20latest%20Metrics%20Server%20release%0A%20%20%20%20%3E%20from%20the%20%60components.yaml%60%20manifest%3A%0A%20%20%20%20%3E%20%60%60%60bash%0A%20%20%20%20%3E%20kubectl%20apply%20-f%20https%3A%2F%2Fgithub.com%2Fkubernetes-sigs%2Fmetrics-server%2Freleases%2Flatest%2Fdownload%2Fcomponents.yaml%0A%20%20%20%20%3E%60%60%60%0A%0A%0A%20%20%20%20%23%23%20Increase%20the%20load%0A%0A%20%20%20%20Let's%20see%20how%20the%20autoscaler%20reacts%20to%20increasing%20the%20load.%20To%20do%20this%2C%20we%20can%20slightly%20modify%20the%20existing%0A%20%20%20%20%60q6_test.py%60%20script%20by%20putting%20the%20operator%20that%20sends%20the%20request%20to%20the%20subscription%20service%20into%20a%20loop.%0A%0A%20%20%20%20%60%60%60python%0A%20%20%20%20while%20True%3A%0A%20%20%20%20%20%20%20%20sleep(0.1)%0A%20%20%20%20%20%20%20%20response%20%3D%20requests.post(url%2C%20json%3Dclient).json()%0A%20%20%20%20%20%20%20%20print(response)%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20Now%20you%20can%20run%20this%20script.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Question%208%20(optional)%0A%0A%20%20%20%20Run%20%60kubectl%20get%20hpa%20subscription-hpa%20--watch%60%20command%20to%20monitor%20how%20the%20autoscaler%20performs.%0A%20%20%20%20Within%20a%20minute%20or%20so%2C%20you%20should%20see%20the%20higher%20CPU%20load%3B%20and%20then%20-%20more%20replicas.%0A%20%20%20%20What%20was%20the%20maximum%20amount%20of%20the%20replicas%20during%20this%20test%3F%0A%0A%0A%20%20%20%20*%201%0A%20%20%20%20*%202%0A%20%20%20%20*%203%0A%20%20%20%20*%204%0A%0A%20%20%20%20%3E%20Note%3A%20It%20may%20take%20a%20few%20minutes%20to%20stabilize%20the%20number%20of%20replicas.%20Since%20the%20amount%20of%20load%20is%20not%20controlled%0A%20%20%20%20%3E%20in%20any%20way%20it%20may%20happen%20that%20the%20final%20number%20of%20replicas%20will%20differ%20from%20initial.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20output%20of%20the%20%60kubectl%20get%20hpa%20subscription-hpa%20--watch%60%20command%20was%3A%0A%0A%20%20%20%20%60%60%60%0A%20%20%20%20NAME%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20REFERENCE%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20TARGETS%20%20%20%20%20%20%20%20MINPODS%20%20%20MAXPODS%20%20%20REPLICAS%20%20%20AGE%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%2011%25%2F20%25%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2016s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%204%25%2F20%25%20%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2030s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%203%25%2F20%25%20%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2045s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%2018%25%2F20%25%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2060s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%2025%25%2F20%25%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2075s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%2024%25%2F20%25%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%2090s%0A%20%20%20%20subscription-hpa%20%20%20Deployment%2Fsubscription%20%20%20cpu%3A%2025%25%2F20%25%20%20%201%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%203%20%20%20%20%20%20%20%20%20%20105s%0A%20%20%20%20%60%60%60%0A%0A%20%20%20%20So%20the%20answer%20is%20**3**.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Submit%20the%20results%0A%0A%20%20%20%20*%20Submit%20your%20results%20here%3A%20https%3A%2F%2Fcourses.datatalks.club%2Fml-zoomcamp-2025%2Fhomework%2Fhw10%0A%20%20%20%20*%20If%20your%20answer%20doesn't%20match%20options%20exactly%2C%20select%20the%20closest%20one.%20If%20the%20answer%20is%20exactly%20in%20between%20two%20options%2C%20select%20the%20higher%20value.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
938faf4c54b72273e03471d3d0549c16