OpenShift install
StackState Self-hosted
Before you start
Before you start the installation of StackState:
- Check that your OpenShift environment meets the requirements 
- Request access credentials to pull the StackState Docker images from StackState support. 
- Ensure you have the OpenShift command line tools installed ( - oc)
- Add the StackState helm repository to the local helm client: 
helm repo add stackstate https://helm.stackstate.io
helm repo updateInstall StackState
Create project
Start by creating the project where you want to install StackState. In our walkthrough we will use the namespace stackstate:
oc new-project stackstateGenerate values.yaml
values.yamlThe values.yaml file is required to deploy StackState with Helm. It contains your StackState license key, StackState Receiver API key and other important information.
The StackState values.yaml file can be generated by running a separate Helm Chart, the stackstate/stackstate-values chart. A sample command line is:
> helm template \
  --set license='<your license>' \
  --set baseUrl='<stackstate-base-url>' \
  --set pullSecret.username='<your-registry-username>' \
  --set pullSecret.password='<your-registry-password>' \
  sts-values \
  stackstate/stackstate-values > values.yamlThis command will generate a values.yaml file which contains the necessary configuration for installing the StackState Helm Chart.
The values that can be passed to this chart are:
Receiver API Key
receiverApiKey
The API key used by StackState to receive data from agents. This is a secret key that should be kept private. If you omit this, a random key will be generated for you.
Base URL
baseUrl
The <STACKSTATE_BASE_URL>. The external URL for StackState that users and agents will use to connect. For example https://stackstate.internal. If you haven't decided on an Ingress configuration yet, use http://localhost:8080. This can be updated later in the generated file.
Username and password**
-u -p
The username and password used by StackState to pull images from quay.io/stackstate repositories. For air-gapped environments these need to be the username and password for the local docker registry.
License key
license
The StackState license key.
Admin API password
adminApiPassword
The password for the admin API. Note that this API contains system maintenance functionality and should only be accessible by the maintainers of the StackState installation. If you omit this, a random password will be generated for you. If you do pass this value and it's not bcrypt hashed, the chart will hash it for you.
Default password
adminPassword
The password for the default user (admin) to access StackState's UI. If you omit this, a random password will be generated for you. If you do pass this value and it's not bcrypt hashed, the chart will hash it for you.
Image Registry
imageRegistry
The registry where the StackState images are hosted. If not provided, the default value will be 'quay.io'
Pull Secret Username
pullSecret.username
The username used to pull images from the Docker registry where the StackState images are hosted.
Pull Secret Password
pullSecret.password
The password used to pull images from the Docker registry where the StackState images are hosted.
Create openshift-values.yaml
openshift-values.yamlBecause OpenShift has stricter security model than plain Kubernetes, all of the standard security contexts in the deployment need to be disabled.
Create a Helm values file openshift-values.yaml with the following content and store it next to the generated values.yaml file. This contains the values that are needed for an OpenShift deployment.
elasticsearch:
  prometheus-elasticsearch-exporter:
    podSecurityContext: ""
  sysctlInitContainer:
    enabled: false
scc:
  enabled: trueDeploy StackState with Helm
The recommended deployment of StackState is a production ready, high availability setup with many services running redundantly. If required, it's also possible to run StackState in a non-redundant setup, where each service has only a single replica. This setup is only recommended for a test environment.
For air-gapped environments follow the instructions for the air-gapped installations.
To deploy StackState in a high availability setup on OpenShift:
- (Optionally) Create a - small_values.yamlif you want to deploy a small profile setup. Add the- --values small_values.yamlflag to the command below.
- Deploy the latest StackState version to the - stackstatenamespace with the following command:
helm upgrade \
  --install \
  --namespace stackstate \
  --values values.yaml \
  --values openshift-values.yaml \
stackstate \
stackstate/stackstate-k8sTo deploy StackState in a non-high availability setup on OpenShift:
- Deploy the latest StackState version to the - stackstatenamespace with the following command:
helm upgrade \
  --install \
  --namespace stackstate \
  --values local-docker-registry.yaml \
  --values values.yaml \
  --values nonha_values.yaml \
  --values openshift-values.yaml \
stackstate \
stackstate/stackstate-k8sTo deploy StackState in a high availability setup on OpenShift:
- (Optionally) Create a - small_values.yamlif you want to deploy a small profile setup. Add the- --values small_values.yamlflag to the command below.
- Deploy the latest StackState version to the - stackstatenamespace with the following command:
helm upgrade \
  --install \
  --namespace stackstate \
  --values local-docker-registry.yaml \
  --values values.yaml \
  --values openshift-values.yaml \
stackstate \
stackstate/stackstate-k8sTo deploy StackState in a non-high availability setup on OpenShift:
- Deploy the latest StackState version to the - stackstatenamespace with the following command:
helm upgrade \
  --install \
  --namespace stackstate \
  --values values.yaml \
  --values nonha_values.yaml \
  --values openshift-values.yaml \
stackstate \
stackstate/stackstate-k8sAfter the install, the StackState release should be listed in the StackState namespace and all pods should be running:
# Check the release is listed
helm list --namespace stackstate
# Check pods are running
# It may take some time for all pods to be installed or available
kubectl get pods --namespace stackstateAccess the StackState UI
After StackState has been deployed, you can check if all pods are up and running:
kubectl get pods --namespace stackstateWhen all pods are up, you can enable a port-forward:
kubectl port-forward service/stackstate-router 8080:8080 --namespace stackstateStackState will now be available in your browser at https://localhost:8080. Log in with the username admin and the default password provided in the values.yaml file.
Next steps are
- Give your co-workers access. 
Manually create SecurityContextConfiguration objects
SecurityContextConfiguration objectsIf you can't use an administrator account to install StackState on OpenShift, ask your administrator to apply the below SecurityContextConfiguration objects.
apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:
  name: {{ template "common.fullname.short" . }}-{{ .Release.Namespace }}
  labels:
    {{- include "common.labels.standard" . | nindent 4 }}
  annotations:
    helm.sh/hook: pre-install
    stackstate.io/note: "Ignored by helm uninstall, has to be deleted manually"
fsGroup:
  type: RunAsAny
groups:
- system:serviceaccounts:{{ .Release.Namespace }}
runAsUser:
  type: RunAsAny
seLinuxContext:
  type: MustRunAs
supplementalGroups:
  type: RunAsAny
volumes:
- configMap
- downwardAPI
- emptyDir
- ephemeral
- persistentVolumeClaim
- projected
- secret
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: false
readOnlyRootFilesystem: falseSee also
- For other configuration and management options, refer to the Kubernetes documentation - manage a StackState Kubernetes installation 
Last updated