This commit is contained in:
parent
1192c7a0bd
commit
5e6d057383
2
__vp
2
__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
|
||||
|
|
BIN
tex/main.pdf
BIN
tex/main.pdf
Binary file not shown.
42
tex/main.tex
42
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}
|
||||
|
||||
|
|
Loading…
Reference in New Issue