This guide is a simple set of steps to install the Coherence Operator and then use that to install a simple Coherence cluster.
Ensure that the Coherence Operator prerequisites are available.
If you want the default Coherence Operator installation then the simplest solution is use kubectl to apply the manifests from the Operator release.
kubectl apply -f https://github.com/oracle/coherence-operator/releases/download/v3.5.9/coherence-operator.yamlThis will create a namespace called coherence and install the Operator into it along with all the required ClusterRole and RoleBinding resources. The coherence namespace can be changed by downloading and editing the yaml file.
|
Note
|
Because the coherence-operator.yaml manifest also creates the namespace, the corresponding kubectl delete command will remove the namespace and everything deployed to it! If you do not want this behaviour you should edit the coherence-operator.yaml to remove the namespace section from the start of the file.
|
Alternatively you can install the Operator using the Helm chart.
Add the Coherence Operator Helm repo to your local Helm.
helm repo add coherence https://oracle.github.io/coherence-operator/charts
helm repo update|
Note
|
To avoid confusion, the URL https://oracle.github.io/coherence-operator/charts is a Helm repo, it is not a web site you open in a browser. You may think we shouldn’t have to say this, but you’d be surprised.
|
helm install \
--namespace <namespace> \
<release-name> \
coherence/coherence-operatore.g. if the Kubernetes namespace is coherence-test the command would be:
helm install --namespace coherence-test operator coherence/coherence-operatoror with Helm v2
helm install --namespace coherence-test --name operator coherence/coherence-operatorSee the full install guide for more details.
Ensure that the Coherence images can be pulled by the Kubernetes cluster,
see Obtain Coherence Images.
By default, a Coherence resource will use the OSS Coherence CE image from Docker Hub.
If a different image is to be used the image name will need to be specified in the Coherence yaml,
see Setting the Application Image for documentation on how to
specify a different images to use.
The minimal required yaml to create a Coherence resource is shown below.
apiVersion: coherence.oracle.com/v1
kind: Coherence
metadata:
name: my-deployment # (1)The only required field is metadata.name which will be used as the Coherence cluster name, in this case my-deployment
kubectl -n <namespace> apply -f my-deployment.yaml|
Note
|
Use the same namespace that the operator was installed into,
e.g. if the namespace is coherence-test the command would be
kubectl -n coherence-test create -f my-deployment.yaml
|
After installing the my-deployment.yaml above here should be a single Coherence resource named my-deployment in the Coherence Operator namespace.
kubectl -n <namespace> get coherenceor alternatively using the Coherence CRD a short name of coh
kubectl -n <namespace> get cohe.g. if the namespace is coherence-test the command would be kubectl -n coherence-test get coherence
NAME AGE
coherence.coherence.oracle.com/my-deployment 19sThe Coherence Operator applies a coherenceDeployment label to all Pods so this label can be used with the kubectl command to find Pods for a CoherenceCoherence resource.
kubectl -n <namespace> get pod -l coherenceDeployment=my-deploymente.g. if the namespace is coherence the command would be:
kubectl -n coherence get pod -l coherenceDeployment=my-deployment
NAME READY STATUS RESTARTS AGE
my-deployment-0 1/1 Running 0 2m58s
my-deployment-1 1/1 Running 0 2m58s
my-deployment-2 1/1 Running 0 2m58sThe Coherence Operator applies a coherenceCluster label to all Pods, so this label can be used with the kubectl
command to find all Pods for a Coherence cluster, which will be made up of multiple Coherence resources.
kubectl -n <namespace> get pod -l coherenceCluster=my-clustere.g. If there is a cluster named my-cluster made up of two Coherence resources in the namespace
coherence-test, one named storage and one named front-end
then the kubectl command to list all Pods for the cluster would be:
kubectl -n coherence-test get pod -l coherenceCluster=my-clusterThe result of which might look something like this
NAME READY STATUS RESTARTS AGE
storage-0 1/1 Running 0 2m58s
storage-1 1/1 Running 0 2m58s
storage-2 1/1 Running 0 2m58s
front-end-0 1/1 Running 0 2m58s
front-end-1 1/1 Running 0 2m58s
front-end-2 1/1 Running 0 2m58sUsing the kubectl scale command a specific Coherence resource can be scaled up or down.
kubectl -n <namespace> scale coherence/my-deployment --replicas=6e.g. if the namespace is coherence-test the command would be:
kubectl -n coherence scale coherence/my-deployment --replicas=6