Creating Deployments
Deployments are where your application is defined including scaling and resource limits.
Last updated
Deployments are where your application is defined including scaling and resource limits.
Last updated
You are browsing the latest version for the release .
Deployments are defined by using the class Larakube\Cluster\Deployment.
You define your deployments in the kube/services.php
file.
The below example creates a deployment for our Laravel application.
To tell your service that it needs to build from a Dockerfile you can use the method below:
This method takes one argument which is the relative path to the service directory of where the Dockerfile is located.
If your Laravel application service is located at kube/services/laravel
and your Dockerfile is located at kube/services/laravel/docker/Dockerfile
then you only need to pass the value docker/Dockerfile
to the method.
You can specify an image and tag for deployment pods to pull from.
You may want to explicitly set the namespace for your service in Kubernetes, you can achieve this with the following method.
You can easily set environment variables for your deployments, they can be hard coded values or come from the current environment, for example when you are deploying from a CI provider.
Take a look at the EnvironmentVariable
class for method reference.
You can set the number of replicas a deployment should have by using the method below.
The container port should be the same port you expose in your Dockerfile and/or the port your application listens on for traffic.
If you wish to change the port you can use the method below.