Install Calico Enterprise on an OpenShift HCP cluster
Big picture
Install Calico Enterprise on an OpenShift Hosted Control Planes (HCP) cluster.
Value
Provides steps to install Calico Enterprise in OpenShift Hosted Control Planes (HCP) clusters on AWS. The steps follow the Red Hat procedure for deploying hosted control planes on AWS, with the changes that Calico Enterprise needs.
Before you begin
-
Ensure that your environment meets the Calico Enterprise system requirements.
-
Ensure that you have a Red Hat account. You need it to get the pull secret that is required to provision an OpenShift cluster. The OpenShift installer supports a subset of AWS regions.
-
Ensure that you have an AWS account that is configured for OpenShift 4.
-
Install the AWS CLI and configure it with credentials for your AWS account.
How to
Create the hosting cluster
Deploy an OpenShift cluster with Calico Enterprise. This will be the hosting cluster with control-plane nodes for all hosted clusters you deploy with the steps below. Set up your KUBECONFIG environment variable to your hosting cluster's kubeconfig file:
export KUBECONFIG=/path/to/kubeconfig
Prepare the hosting cluster for hosted control planes
Set up the hosted control planes feature on the hosting cluster and create the AWS resources that hosted clusters need. Red Hat documents each of these steps.
-
Install the multicluster engine for Kubernetes operator, version 2.5 or later, on the hosting cluster. The multicluster engine operator runs the HyperShift operator for you. If the hosted control planes feature is turned off, turn it on.
-
Verify that the
local-clustermanaged cluster exists:oc get managedclusters local-cluster -
Create a routable public zone for the base domain of your hosted clusters.
-
Create an AWS IAM role and STS credentials. You need the role ARN and the
sts-creds.jsonfile when you create the hosted cluster. STS credentials expire, so get new ones if yours have expired. -
Install the
hcpCLI from the hosting cluster:oc get consoleclidownload hcp-cli-download -o jsonpath='{range .spec.links[*]}{.text}{"\t"}{.href}{"\n"}{end}'Download the archive for your platform from a link in the output, then extract the
hcpbinary and add it to yourPATH. For more options, see Installing the hosted control planes command-line interface.
Create a hosted cluster
Create a hosted cluster with no default CNI, so that you can install Calico Enterprise on it.
- Create a HostedCluster and set its HostedCluster.spec.networking.networkType to Other:
Make sure to adjust the variables for the command below to the correct values for your cluster, credentials and environment.
HOSTED_CLUSTER_NAME=my-os-hosted-cluster
HOSTED_CLUSTER_NS=clusters
REGION=us-west-2
BASE_DOMAIN=www.example.com
PULL_SECRET="$HOME/.secrets/redhat-pull-secret.txt"
STS_CREDS="$HOME/sts-creds.json"
ROLE_ARN="arn:aws:iam::123456789012:role/hcp-cli-role"
hcp create cluster aws \
--name $HOSTED_CLUSTER_NAME \
--infra-id $HOSTED_CLUSTER_NAME \
--namespace $HOSTED_CLUSTER_NS \
--node-pool-replicas 3 \
--base-domain $BASE_DOMAIN \
--pull-secret $PULL_SECRET \
--sts-creds $STS_CREDS \
--role-arn $ROLE_ARN \
--region $REGION \
--generate-ssh \
--network-type Other
Wait until the hosted cluster reports Available:
oc wait --for=condition=Available --timeout=30m -n $HOSTED_CLUSTER_NS hostedcluster/$HOSTED_CLUSTER_NAME
Then use the hcp CLI to generate the kubeconfig file.
Create a separate directory for the hosted cluster, so that you do not mix up configuration and manifests from the hosting and hosted clusters:
mkdir my_hosted_cluster && cd my_hosted_cluster
hcp create kubeconfig --namespace $HOSTED_CLUSTER_NS --name $HOSTED_CLUSTER_NAME > hosted_kubeconfig && export KUBECONFIG=$(pwd)/hosted_kubeconfig
Nodes join the hosted cluster over the next few minutes.
They show as NotReady in oc get nodes until you install Calico Enterprise.
This is expected.
Then, copy the aws-creds secret from the hosting cluster to the hosted cluster. Run this using the hosting cluster kubeconfig to extract the secret to a yaml file:
oc get secrets --kubeconfig /path/to/hosting/kubeconfig -n kube-system aws-creds -o yaml > aws-creds.yaml
Then import it in the hosted cluster:
oc apply --kubeconfig /path/to/hosted/kubeconfig -f aws-creds.yaml
There is no need to specify the --kubeconfig CLI argument if the hosted cluster's kubeconfig file is configured as the KUBECONFIG environment variable in your shell.
Create a storage class
Calico Enterprise requires storage for logs and reports. Before finishing the installation, you must create a StorageClass for Calico Enterprise.
Download the Calico Enterprise install manifests
Download the Calico Enterprise manifests for OpenShift:
mkdir calico
wget -qO- https://downloads.tigera.io/ee/v3.23.3/manifests/ocp.tgz | tar xvz --strip-components=1 -C calico
Add an image pull secret
Update the contents of the secret with the image pull secret provided to you by a Tigera support representative.
For example, if the secret is located at ~/.docker/config.json, run the following commands.
SECRET=$(cat ~/.docker/config.json | tr -d '\n\r\t ' | base64 -w 0)
sed -i "s/SECRET/${SECRET}/" calico/02-pull-secret.yaml
Optionally provide additional configuration
You may want to provide Calico with additional configuration at install-time. For example, BGP configuration or peers. You can use a Kubernetes ConfigMap with your desired Calico resources to set configuration as part of the installation. If you do not need to provide additional configuration, you can skip this section.
To include Calico resources during installation, edit calico_hosted/02-configmap-calico-resources.yaml to add your own configuration.
If you have a directory with the Calico resources, you can create the file with the command:
oc create configmap -n tigera-operator calico-resources \
--from-file=<resource-directory> --dry-run -o yaml \
calico/02-configmap-calico-resources.yaml
With recent versions of oc it is necessary to have a kubeconfig configured or add --server='127.0.0.1:443'
even though it is not used.
If you have provided a calico-resources configmap and the tigera-operator pod fails to come up with Init:CrashLoopBackOff,
check the output of the init-container with oc logs -n tigera-operator -l k8s-app=tigera-operator -c create-initial-resources.
Apply the Calico Enterprise install manifests
Apply the install manifests paying attention to the required order. First apply all necessary manifests to install the Tigera Operator:
cd calico/
ls 00* | xargs -n1 oc apply -f
ls 01* | xargs -n1 oc apply -f
ls 02* | xargs -n1 oc apply -f
Then wait until the Tigera Operator has created the CustomResourceDefinitions (CRDs) that the 03* files need, and the API server has established them.
Only then apply the custom resources that install Calico Enterprise on your cluster:
timeout --foreground 600 bash -c "while ! oc get crd installations.operator.tigera.io apiservers.operator.tigera.io; do sleep 5; done"
oc wait --for=condition=Established --timeout=120s crd/installations.operator.tigera.io crd/apiservers.operator.tigera.io
ls 03* | xargs -n1 oc apply -f
You can safely ignore any ls: cannot access '0X*': No such file or directory errors if there's no yaml files with that prefix to be applied.
Install the Calico Enterprise license
In order to use Calico Enterprise, you must install the license provided to you by Tigera support representative. Before applying the license, wait until the Tigera API server is ready with the following command:
watch oc get tigerastatus
Wait until the apiserver shows a status of Available.
After the Tigera API server is ready, apply the license:
oc create -f </path/to/license.yaml>
Install Calico Enterprise resources
Apply the custom resources for enterprise features.
oc create -f https://downloads.tigera.io/ee/v3.23.3/manifests/ocp/tigera-enterprise-resources.yaml
Apply the Calico Enterprise manifests for the Prometheus operator.
oc create -f https://downloads.tigera.io/ee/v3.23.3/manifests/ocp/tigera-prometheus-operator.yaml
You can now monitor progress with the following command:
watch oc get tigerastatus
When it shows all components with status Available, proceed to the next step.
(Optional) Apply the full CRDs including descriptions.
oc apply --server-side --force-conflicts -f https://downloads.tigera.io/ee/v3.23.3/manifests/operator-crds.yaml
Next steps
Recommended
- Configure access to the Calico Enterprise web console
- Authentication quickstart
- Configure your own identity provider
Recommended - Networking
- The default networking uses IP in IP encapsulation with BGP routing. For all networking options, see Determine best networking option.
Recommended - Security