Skip to content

Update minikube.md #2043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions deployment/minikube.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,58 @@
# Deploying to Minikube
# Deploying to minikube

## Install Minikube
## Install minikube

If you have no existing installation of Minikube on your computer, [follow the official tutorial](https://minikube.sigs.k8s.io/docs/start/).
If you have no existing installation of minikube on your computer, [follow the official tutorial](https://minikube.sigs.k8s.io/docs/start/).

When Minikube is installed, start the cluster:

```console
minikube start --addons registry --addons dashboard
```

The previous command starts Minikube with a Docker registry (we'll use it in the next step) and with the Kubernetes dashboard.

If you use Mac or Windows, [refer to the documentation](https://minikube.sigs.k8s.io/docs/handbook/registry/#docker-on-macos) to learn how to expose the Docker registry installed as an addon on the port 5000 of the host.
The previous command starts minikube with a Docker registry (we'll use it in the next step) and with the Kubernetes dashboard.

Finally, [install Helm](https://helm.sh/docs/intro/install/). We'll use it to deploy the application in the cluster thanks to the chart provided in the API Platform distribution.

## Building and Pushing Docker Images

First, build the images:
On GNU/Linux and macOS, run the following command following command to point your terminal’s docker-cli to the Docker Engine inside minikube:

```console
eval $(minikube docker-env)
```

Now any `docker` command you run in this current terminal will run against the Docker Engine inside the minikube cluster. For detailed explanation and instructions for Windows [visit official minikube documentation](https://minikube.sigs.k8s.io/docs/handbook/pushing/#1-pushing-directly-to-the-in-cluster-docker-daemon-docker-env).

Build the images in minikube:

```console
docker build -t localhost:5000/php api --target api_platform_php
docker build -t localhost:5000/caddy api --target api_platform_caddy
docker build -t localhost:5000/pwa pwa --target api_platform_pwa_prod
docker build -t localhost:5000/php api --target frankenphp_prod
docker build -t localhost:5000/pwa pwa --target prod
```

Then push the images in the registry installed in Minikube:
Then push the images in the registry available in minikube:

```console
docker push localhost:5000/php
docker push localhost:5000/caddy
docker push localhost:5000/pwa
```

## Deploying

Fetch Helm chart dependencies:

```console
helm repo add postgresql https://charts.bitnami.com/bitnami/
helm dependency build helm/api-platform
```

Finally, deploy the project using the Helm chart:

```console
$ helm install my-project helm/api-platform \
helm install my-project helm/api-platform \
--set php.image.repository=localhost:5000/php \
--set php.image.tag=latest \
--set caddy.image.repository=localhost:5000/caddy \
--set caddy.image.tag=latest \
--set pwa.image.repository=localhost:5000/pwa \
--set pwa.image.tag=latest
```
Expand Down