Create Custom Resource in Kubernetes Service
Operator needs a resource file that declares the customary resources of the cluster that you created in the Kubernetes. Operator uses this custom resource file to declare the kubernetes cluster with your desired state.
To make sure the operator gets access to custom resources, you need tp create a manifest file and deploy it in the cluster. Follow the steps provided below:
Create Manifest File for Custom Resources
ncache_custom_resource.yaml file lists the desired state of your kubernetes service cluster under the spec
section.
Note
The parameters required to create this YAML file, ready to be deployed, are explained in the Properties section.
kind: NCache
apiVersion: alachisoft.ncache/v1
metadata:
name: ncache
spec:
# Add fields here
clusterSize: 1
image: enterprise-server-5.2-linux # NCache container image
nodeSelector:
kubernetes.io/os: linux
podRequests:
memory: "512Mi"
cpu: 1
podLimits:
memory: "512Mi"
cpu: 1
debug:
enable: false
parameters:
'{"registrationInfo": {"email": "john_smith@yourcompany.com","firstName": "John","lastName": "Smith","company": "Your Company","environment": "Production","clientLicenses": "8", "licenseKey": "xxxxxxx-xxxxxxx-xxxxxxx"}}'
Note
You can provide Evaluation Key instead of License Key in the parameters
section to activate NCache in evaluation mode.
"evaluationKey": "xxxxxxxxxxxxxxxxxxxxxxxxxx"
Deploy Custom Resources Using Kubernetes Service
To deploy the desired state specified in the ncache_custom_resource.yaml, you need to execute the following command in the cloud shell:
kubectl create -f [dir]/ncache_custom_resource.yaml
On execution of this command, operator will activate your NCache Kuberenetes Service cluster using the registration information provided in the custom resource file.
For verification, run the following command:
kubectl get pods -w
Properties
The properties required to create and deploy a custom resource in your kubernetes service cluster are explained below:
Parameter | Description |
---|---|
-kind |
Specifies the kind of the custom resource to deploy. In this case, it is NCache. |
-apiVersion |
Specifies the version of the custom resource that is to be deployed in k8s. |
-name |
Specifies the name of the deployment. |
-clusterSize |
Specifies the number of servers of NCache cluster. |
-image |
Specifies path of the container image of NCache. |
-nodeSelector |
Specifies the node on which the underlying container needs to be hosted. |
-podRequests |
Specifies the limits on requests required at the time of scheduling. |
-podLimits |
Specifies the limits on pods. If this is not provided, the pod will use the maximum memory and CPU limit. |
-parameters |
Specifies the registration information to install NCache in the container. |
See Also
Create Service Account
Create Role Binding
Create Role Definition
Create NCache Operator