Install OCI Service Operator for Kubernetes for Service Mesh
The OCI Service Operator for Kubernetes makes it easy to create, manage, and connect
to OCI resources from a Kubernetes environment. Kubernetes users can simply install OCI
Service Operator for Kubernetes and perform actions on OCI resources using the Kubernetes
API. The OCI Service Operator for Kubernetes removes the need to use the OCI CLI or other
OCI developer tools to interact with a service API.
OCI Service Operator for Kubernetes is based on the Operator Framework, an open
source toolkit used to manage Operators. It uses the controller-runtime library,
which provides high-level APIs and abstractions to write operational logic and also
provides tools for scaffolding and code generation for Operators.
For more information on the Operator SDK, see the Operator
Framework site.
Install the Operator SDK and OLM
Install the Operator SDK on your local machine using the following steps.
Install the Operator Lifecycle Manager (OLM). The OLM helps users install,
update, and manage the lifecycle of Kubernetes native applications (Operators)
and their associated services running in clusters. Use the following command to
install:
Copy
operator-sdk olm install --version 0.20.0
Note
Local access to your Kubernetes cluster must be set up on your machine
before you can perform this step.
Verify your installation of OLM by first checking for all the necessary Customer
Resource Definitions (CRDs) in the cluster. Run the following command.
Copy
operator-sdk olm status
The command produces output similar to the following:
The OCI Service Operator for Kubernetes OLM bundle contains all the required details
like CRDs, RBACs, and ConfigMaps. Deployment installs the OCI Service Operator for
Kubernetes in the Kubernetes cluster. First, create a namespace for your
operator.
Copy
kubectl create ns oci-service-operator-system
Note
If deployed in your application namespace, the operator functions normally. This
option is an alternative to creating an operator namespace.
Install the OCI Service Operator for Kubernetes Operator in the Kubernetes cluster in
your namespace (oci-service-operator-system) using the following
command.
Copy
operator-sdk run bundle iad.ocir.io/oracle/oci-service-operator-bundle:X.X.X -n oci-service-operator-system --timeout 5m
Users must be logged into the Oracle Registry at iad.ocir.io in Docker to run the command. To ensure you are logged in, see Pulling Images Using the Docker CLI.
The command produces output similar to the following:
INFO[0036] Successfully created registry pod: iad-ocir-io-oracle-oci-service-operator-bundle-X-X-X
INFO[0036] Created CatalogSource: oci-service-operator-catalog
INFO[0037] OperatorGroup "operator-sdk-og" created
INFO[0037] Created Subscription: oci-service-operator-vX-X-X-sub
INFO[0040] Approved InstallPlan install-tzk5f for the Subscription: oci-service-operator-vX-X-X-sub
INFO[0040] Waiting for ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" to reach 'Succeeded' phase
INFO[0040] Waiting for ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" to appear
INFO[0048] Found ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" phase: Pending
INFO[0049] Found ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" phase: InstallReady
INFO[0053] Found ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" phase: Installing
INFO[0066] Found ClusterServiceVersion "oci-service-operator-system/oci-service-operator.vX.X.X" phase: Succeeded
INFO[0067] OLM has successfully installed "oci-service-operator.vX.X.X"
To verify the installation, perform the following steps.
If you are going to use Ingress Gateway, install metrics server. The Kubernetes
Horizontal Pod Autoscalar uses the metrics server to scale the number of pods in the
ingress gateway based on CPU usage. The metrics server is installed using the
following command:
As an alternative, bring your own certificate (BYOC) to secure communications.
Kubernetes provides a certificates.k8s.io API, which lets you
provision TLS certificates signed by a Certificate Authority (CA) that you control.
The CA and certificates are used by your workloads to establish trust. To establish
trust between OCI Service Operator for Kubernetes and Kubernetes, use
certificates.k8s.io to create the CA and certificates. Patch
the oci-service-operator-controller-manager-service-cert secret to
use the new CA and certificates.
To generate the CA and CertificateBundle use tools like cfssl(Cloudfare SSL) or
OpenSSL. To use a user created CA, install the default configuration and patch the
kubernetes.io/tls generated by OLM for OCI Service Operator for
Kubernetes. The following steps demonstrate the configuration steps using CFSSL.
Note
In the following steps, replace {operators-namespace} with the
namespace your operator runs in.
Create a Certificate Signing Request(CSR) and private key with
cfssl following steps:
This command generates two files. The server.csr file
contains the PEM encoded CSR. The server-key.pem file
contains the PEM encoded key to the certificate that is yet to be
created.
Create CSR manifest and send it to Kubernetes following section.
Validate oci-service-operator-controller-manager-service-cert
contains the latest values.
With the preceding steps complete, the resources are created and working.
However, if you get an error: x509: certificate signed by unknown
authority, review the following steps to troubleshoot.
Validate if the CSR has a condition of "Approved, Issued." Otherwise,
start again from step (3)(c).
Validate if base64 decoded olmCAKey matches the
server.crt from step (3)(d). Otherwise, update the
olmCAKey with the server.crt
file.
Validate if base64 decoded tls.key matches the
server-key.pem file from step (1). Otherwise,
update the tls.key with the
server-key.pem file.
Validate if base64 decoded tls.crt matches the
ca-key.pem file from step (3)(a). Otherwise, update
tls.crt with the ca-key.pem
file.
Set up Resources Required for Service Mesh 🔗
Set up Steps 🔗
To start using Service Mesh, you have a few requirements to fulfill before you can
create your own meshes.
If you are not an administrator, ask your administrator to give you access to resources of three services: Service Mesh, Vault, and Certificates. Your administrator can give you access to these services with Identity and Access Management (IAM) policies.
To prepare your tenancy to use Service Mesh, perform the following steps with your OCI account.
Add a
Hardware Security Module (HSM) encryption key for your vault. See Managing Keys for details. For your
certificate authority key, you can use a Rivest-Shamir-Adleman (RSA)
2,048-bit key or 4,096-bit key.
The Maximum Validity Duration for Certificates (Days)
setting on the certificate authority must be at least 45 days.
Create a TLS certificate so clients can make TLS connections to your
application. This certificate keeps HTTP requests to ingress gateways TLS
encrypted. See Managing Certificates for details.
More Information
For more information on IAM policies related to Service Mesh, see:
If you need to remove Service Mesh support from your application, see the Unmeshify Your Application (Optional) section in Service Mesh Overview Tutorial.