You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/deploying-to-kubernetes.adoc
+63-9Lines changed: 63 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -388,12 +388,53 @@ To access the API server from within a Kubernetes cluster, some RBAC related res
388
388
So, when the `kubernetes-client` extension is present, the `kubernetes` extension is going to create those resources automatically, so that application will be granted the `view` role.
389
389
If more roles are required, they will have to be added manually.
390
390
391
+
=== Deploying to Minikube
392
+
393
+
https://github.com/kubernetes/minikube[Minikube] is quite popular when a Kubernetes cluster is needed for development purposes. To make the deployment to Minikube
394
+
experience as frictionless as possible, Quarkus provides the `quarkus-minikube` extension. This extension can be added to a project like so:
395
+
396
+
[source,xml]
397
+
----
398
+
<dependency>
399
+
<groupId>io.quarkus</groupId>
400
+
<artifactId>quarkus-minikube</artifactId>
401
+
</dependency>
402
+
----
403
+
404
+
The purpose of this extension is to generate Kubernetes manifests (`minikube.yaml` and `minikube.json`) that are tailored to Minikube.
405
+
This extension assumes a couple things:
406
+
407
+
* Users won't be using an image registry and will instead make their container image accessible to the Kubernetes cluster by building it directly
408
+
into Minikube's Docker daemon. To use Minikube's Docker daemon you must first execute:
409
+
+
410
+
[source]
411
+
----
412
+
eval $(minikube -p minikube docker-env)
413
+
----
414
+
415
+
* Applications deployed to Kubernetes won't be accessed via a Kubernetes `Ingress`, but rather as a `NodePort` `Service`.
416
+
The advantage of doing this is that the URL of an application can be retrieved trivially by executing:
417
+
+
418
+
[source]
419
+
----
420
+
minikube service list
421
+
----
422
+
423
+
To control the https://kubernetes.io/docs/concepts/services-networking/service/#nodeport[nodePort] that is used in this case, users can set `quarkus.kubernetes.node-port`.
424
+
Note however that this configuration is entirely optional because Quarkus will automatically use a proper (and non-changing) value if none is set.
425
+
426
+
WARNING: It is highly discouraged to use the manifests generated by the Minikube extension when deploying to production as these manifests are intended for development purposes
427
+
only. When deploying to production, consider using the vanilla Kubernetes manifests (or the OpenShift ones when targeting OpenShift).
428
+
429
+
NOTE: If the assumptions the Minikube extension makes don't fit your workflow, nothing prevents you from using the regular Kubernetes extension to generate Kubernetes manifests
430
+
and apply those to your Minikube cluster.
431
+
391
432
== Tuning the generated resources using application.properties
392
433
393
434
The Kubernetes extension allows tuning the generated manifest, using the `application.properties` file.
394
435
Here are some examples:
395
436
396
-
== Configuration options
437
+
=== Configuration options
397
438
398
439
The table below describe all the available configuration options.
399
440
@@ -445,7 +486,7 @@ In this example `initial-delay` and `period` are fields of the type `Probe`.
445
486
Below you will find tables describing all available types.
Mentioned in the previous sections was the concept of `deployment-target`. This concept allows users to control which Kubernetes manifests will be generated
781
+
and deployed to a cluster (if `quarkus.kubernetes.deploy` has been set to `true`).
782
+
783
+
By default, when no `deployment-target` is set, then only vanilla Kubernetes resources are generated and deployed. When multiple values are set (for example
784
+
`quarkus.kubernetes.deployment-target=kubernetes,openshift`) then the resources for all targets are generated, but only the resources
785
+
that correspond to the *first* target are applied to the cluster (if deployment is enabled).
786
+
787
+
In the case of wrapper extensions like OpenShift and Minikube, when these extensions have been explicitly added to the project, the default `deployment-target`
788
+
is set by those extensions. For example if `quarkus-minikube` has been added to a project, then `minikube` becomes the default deployment target and its
789
+
resources will be applied to the Kubernetes cluster when deployment via `quarkus.kubernetes.deploy` has been set.
790
+
Users can still override the deployment-targets manually using `quarkus.kubernetes.deployment-target`.
737
791
738
792
=== Deprecated configuration
739
793
@@ -818,7 +872,7 @@ The name of the resource is determined by the application name and may be overri
818
872
For example, in the `kubernetes-quickstart` application, we can add a `kubernetes.yml` file in the `src/main/kubernetes` that looks like:
819
873
820
874
[source,yaml]
821
-
---
875
+
----
822
876
apiVersion: apps/v1
823
877
kind: Deployment
824
878
metadata:
@@ -843,12 +897,12 @@ spec:
843
897
env:
844
898
- name: FOO
845
899
value: BAR
846
-
---
900
+
----
847
901
848
902
The generated `kubernetes.yml` will look like:
849
903
850
904
[source,yaml]
851
-
---
905
+
----
852
906
apiVersion: "apps/v1"
853
907
kind: "Deployment"
854
908
metadata:
@@ -882,7 +936,7 @@ spec:
882
936
name: "http"
883
937
protocol: "TCP"
884
938
serviceAccount: "kubernetes-quickstart"
885
-
---
939
+
----
886
940
887
941
The provided replicas <1>, labels <2> and environment variables <3> were retained. However, the image <4> and container port <5> were modified. Moreover, the default annotations have been added.
0 commit comments