Cloudstate services are deployed to Kubernetes using the
StatefulService resource. Here is a minimal example:
apiVersion: cloudstate.io/v1alpha1 kind: StatefulService metadata: name: shopping-cart spec: containers: - image: my-docker-hub-username/shopping-cart:latest
Upon deploying this, the Cloudstate operator will create a Kubernetes
Deployment that contains the container configured in the descriptor, along with a sidecar container for the Cloudstate proxy. The operator will also deploy a Kubernetes
Service to allow other services to consume the Cloudstate service.
The container specification is modeled off the container specification in the
Pod resource. Cloudstate will inject some additional configuration:
- If no ports are specified, in the container, a port of
8080will be created, otherwise, the first declared port will be taken and assumed to be the port that the proxy should use to communicate with the user function.
- The port that the user function should use will be available in the environment variable
- The name of the container will be ignored, and is hardcoded to
The following additional fields are available to customize the service:
- Configures the datastore. This is discussed in detail in Stateful stores. If not configured, no store will be used, and support for any entity types that require a store will not be available on the proxy.
- Configures autoscaling. This is discussed in detail in Autoscaling. This field is likely to change.
- The name of the service account that the pod should run using. Defaults to the default service account.
- A list of volumes to configure for pods.
- Resource requirements to set for the sidecar. Uses the same structure as a container resources field. This field is likely to change.
- Heap space to allocate for the sidecar, using the
-Xmxoption. This currently has no effect for native images, and is likely to change.
- Used to specify the Pod nodeSelector. This field is likely to change.
- Used to specify the Pod tolerations. This field is likely to change.