diff --git a/__build b/__build new file mode 100644 index 0000000..a8943db --- /dev/null +++ b/__build @@ -0,0 +1 @@ +docker build -f Dockerfile -t zoz:latest .. diff --git a/__vp b/__vp index 41e072b..e0d441f 100644 --- a/__vp +++ b/__vp @@ -2,6 +2,6 @@ f() { sudo docker run --rm -dit --privileged \ -v "$(pwd)/app:/home/user/work" \ -p 3333:3333 \ - --name "$1" deb su - user; + --name "$1" zoz:latest su - user; }; f $1 diff --git a/tex/main.pdf b/tex/main.pdf index a673199..cca6aff 100644 Binary files a/tex/main.pdf and b/tex/main.pdf differ diff --git a/tex/main.tex b/tex/main.tex index 69adaaf..95398ce 100644 --- a/tex/main.tex +++ b/tex/main.tex @@ -81,5 +81,47 @@ kubectl run my-app --image=localhost:5000/my-app:latest --image-pull-policy=IfNo \end{lstlisting} \end{enumerate} +\section{Adding a Docker Image to Minikube and Exposing It} + +\subsection{Load Docker Image into Minikube} + +1. \textbf{Build and Load Docker Image Directly into Minikube:} + If the image is built locally, you can load it directly into Minikube: + + \begin{lstlisting} + minikube image load my-app:latest + \end{lstlisting} + + Alternatively, if you are using a local registry, ensure Minikube can access it by setting the registry address in the image tag. + +\subsection{Create and Run a Pod with the Loaded Image} + +1. \textbf{Create a Deployment in Minikube:} + Create a Kubernetes Deployment to manage the pod using the loaded image: + + \begin{lstlisting} + kubectl create deployment my-app --image=my-app:latest + \end{lstlisting} + +2. \textbf{Expose the Deployment as a Service:} + Expose the Deployment to make the application accessible on an external port: + + \begin{lstlisting} + kubectl expose deployment my-app --type=NodePort --port=80 --target-port=8080 + \end{lstlisting} + + In this example, Kubernetes maps port 80 of the service to port 8080 of the container. Modify `target-port` if your application uses a different port. + +\subsection{Access the Application Externally} + +1. \textbf{Retrieve the Minikube Service URL:} + Minikube provides a command to get the external URL for accessing services. Run the following command to get the URL: + + \begin{lstlisting} + minikube service my-app --url + \end{lstlisting} + + This command will output a URL that you can use to access the service from outside of Minikube. + \end{document}