|
1 | | -# MarkLogic Kubernetes Operator (Private Repo) |
| 1 | +# MarkLogic Operator for Kuberentes |
2 | 2 |
|
3 | 3 | ## Introduction |
4 | 4 |
|
5 | | -The MarkLogic Kubernetes Operator is a tool that allows you to deploy and manage MarkLogic clusters on Kubernetes. It provides a declarative way to define and manage MarkLogic resources such as clusters, databases, and forests. |
| 5 | +The MarkLogic Operator for Kubernetes is an operator that allows you to deploy and manage MarkLogic clusters on Kubernetes. It provides a declarative way to define and manage MarkLogic resources. For detailed documentation, please refer to [MarkLogic Operator for Kubernetes](https://docs.progress.com/bundle/marklogic-server-on-kubernetes). |
6 | 6 |
|
7 | | -## Code Structure |
8 | | -api/ Contains the API definition |
9 | | -internal/controller Contains the code for controllers |
10 | | -config/ Contains configuration files to launch the project on a cluster |
11 | | -config/samples/ Contains the samples to create marklogic cluster using the Operator. |
12 | | -test/ Contains E2E tests for the operator |
13 | | -pkg/ Contains golang packges to support reconciliation, utilities. |
| 7 | +## Getting Started |
14 | 8 |
|
15 | | -## Run or deploy Operator |
| 9 | +### Prerequisites |
16 | 10 |
|
17 | | -### Deploy Operator with Helm Chart in Private Repo |
18 | | -The EA release is currently in a private repository. To access and work with this private repository, please follow these steps: |
19 | | -1. First you need to create a Fine-grained tokens in Github with Read-only permission for marklogic/marklogic-kubernetes-operator repository |
20 | | - Once you have the token, put store it in a safe place and put it in the environmental variable: |
21 | | -```sh |
22 | | -GITHUB_TOKEN=<YOUR_GITHUB_TOKEN> |
23 | | -``` |
24 | | -2. Then add the private repo to Helm repository with the GITHUB_TOKEN: |
| 11 | +[Helm](https://helm.sh/docs/intro/install/) v3.0.0 or later and [Kubectl](https://kubernetes.io/docs/tasks/tools/) v1.30 or same as your Kubernetes version must be installed locally in order to use MarkLogic operator helm chart. |
| 12 | + |
| 13 | +### Kubernetes Version |
| 14 | + |
| 15 | +This operator supports Kubernetes 1.30 or later. |
| 16 | + |
| 17 | +### MarkLogic Version |
| 18 | + |
| 19 | +This operator supports MarkLogic 11.1 or later. |
| 20 | + |
| 21 | +### Run MarkLogic Operator for Kubernetes using Helm Chart |
| 22 | + |
| 23 | +1. Add MarkLogic Operator for Kubernees Helm Repo: |
25 | 24 | ```sh |
26 | | -helm repo add marklogic-private https://raw.githubusercontent.com/marklogic/marklogic-kubernetes-operator/gh-pages/ --username <YOUR_USERNAME> --password $GITHUB_TOKEN |
| 25 | +helm repo add marklogic-operator-kubernetes https://raw.githubusercontent.com/marklogic/marklogic-operator-kubernetes/gh-pages/ |
| 26 | + |
27 | 27 | helm repo update |
28 | 28 | ``` |
29 | | -3. Install the Helm Chart for MarkLogic Operator: |
| 29 | + |
| 30 | +2. Install the Helm Chart for MarkLogic Operator: |
30 | 31 | ```sh |
31 | | -helm upgrade marklogic-operator marklogic-private/marklogic-operator --version=1.0.0-ea2 --install --namespace marklogic-operator-system --create-namespace |
| 32 | +helm upgrade marklogic-operator-kubernetes marklogic-operator-kubernetes/marklogic-operator-kubernetes --version=1.0.0 --install --namespace marklogic-operator-system --create-namespace |
32 | 33 | ``` |
33 | | -4. Check the Operator Pod and make sure it is in Running state: |
| 34 | + |
| 35 | +3. Make sure the Marklogic Operator pod is running: |
34 | 36 | ```sh |
35 | 37 | kubectl get pods -n marklogic-operator-system |
36 | 38 | ``` |
37 | 39 |
|
38 | | -### Run Operator locally |
39 | | -After checking out the source code, you can run the MarkLogic Operator locally by following these steps: |
| 40 | +### Install MarkLogic Cluster |
| 41 | +Once MarkLogic Operator Pod is running, use your custom manifests or choose from sample manifests from this repository located in the ./config/samples directory. For example, to deploy marklogic single group, use the `quick_start.yaml` from the samples: |
40 | 42 | ```sh |
41 | | -make build # build the project |
42 | | -make install # instal CRD to Kubernetes cluster |
43 | | -make run # run the operator controller locally |
| 43 | +kubectl apply -f quick_start.yaml |
44 | 44 | ``` |
| 45 | +Once the installation is complete and the pod is in a running state, the MarkLogic Admin UI can be accessed using the port-forwarding command: |
45 | 46 |
|
46 | | -### Deploy Operator locally |
47 | | -After checking out the source code, you can deploy the MarkLogic Operator locally by following these steps: |
48 | | -```sh |
49 | | -make build # build the project |
50 | | -make docker-build # build the operator to docker image |
51 | | -make docker-push # push the operator to remote docker repo |
52 | | -make deploy # deploy the CRD and Operator into marklogic-operator-system namespace |
53 | | -``` |
| 47 | + ```shell |
| 48 | + kubectl port-forward <pod-name> 8000:8000 8001:8001 --namespace=<namespace-name> |
| 49 | + ``` |
54 | 50 |
|
55 | | -### Build Helm Chart locally |
56 | | -If you don't have the GITHUB_TOKEN that is required to visit the Github Repo, you can also build the Helm Chart locally. |
57 | | -First build the Helm Chart |
58 | | -```sh |
59 | | -make build |
60 | | -make docker-build |
61 | | -make helm |
62 | | -``` |
63 | | -Then deploy the Operator with Helm Chart |
64 | | -```sh |
65 | | -helm upgrade marklogic-operator ./charts/marklogic-operator --install --namespace marklogic-operator-system --create-namespace |
66 | | -``` |
| 51 | +If you used the automatically generated admin credentials, use these steps to extract the admin username, password, and wallet-password from a secret: |
67 | 52 |
|
68 | | -## Install MarkLogic Cluster with MarkLogic Operator |
69 | | -Once MarkLogic Operator is installed, go to config/samples folder and pick one sample file to deploy. For example, to deploy marklogic single group, use the following script: |
70 | | -```sh |
71 | | -kubectl apply -f marklogicgroup.yaml |
72 | | -``` |
| 53 | +1. Run this command to fetch all of the secret names: |
| 54 | + ```shell |
| 55 | + kubectl get secrets |
| 56 | + ``` |
| 57 | +The MarkLogic admin secret name is in the format `<marklogicCluster-name>-admin`. For example if markLogicCluster name is `single-node`, the secret name is `single-node-admin`. |
73 | 58 |
|
74 | | -### Configure HAProxy Load Balancer |
75 | | -HAProxy is provided as a load balancer configured to support cookie-based session affinity and multi-statement transactions. These configurations are needed by some MarkLogic client applications, like mlcp. HAProxy is recommended for production workloads. |
| 59 | +2. Using the secret name from step 1, retrieve the MarkLogic admin credentials using these commands: |
| 60 | + ```shell |
| 61 | + kubectl get secret single-node-admin -o jsonpath='{.data.username}' | base64 --decode |
76 | 62 |
|
77 | | -#### Enable the HAProxy Load Balancer |
78 | | -The HAProxy Load Balancer is disabled by default. To enable it, provide the following configuration in the crd yaml file to be used for cluster creation: |
79 | | -``` |
80 | | -haproxy: |
81 | | - enabled: true |
82 | | -``` |
83 | | -#### Configuration |
84 | | -HAProxy can be configured for cluster. To setup the access for default App Servers for 8000, 8001 and 8002, uncomment the appServer seciton in marklogicgroup.yaml. |
85 | | -``` |
86 | | - appServers: |
87 | | - - name: "app-service" |
88 | | - port: 8000 |
89 | | - path: "/console" |
90 | | - - name: "admin" |
91 | | - port: 8001 |
92 | | - path: "/adminUI" |
93 | | - - name: "manage" |
94 | | - port: 8002 |
95 | | - path: "/manage" |
96 | | -``` |
97 | | -Ports can be configured for additional app servers. For example, to add port 8010 for HTTP load balancing, add this configuration to the marklogicgroup.yaml file appServer section: |
98 | | -``` |
99 | | -- name: my-app-1 |
100 | | - port: 8010 |
101 | | - targetPort: 8010 |
102 | | -``` |
103 | | -#### Access HA Proxy |
104 | | -The HAProxy can be accessed from a service with the name of marklogic-haproxy. |
| 63 | + kubectl get secret single-node-admin -o jsonpath='{.data.password}' | base64 --decode |
105 | 64 |
|
106 | | -#### External access |
107 | | -By default, HAProxy is configured to provide access within the Kubernetes cluster. However, HAProxy can provide external access by setting the service type in the marklogicgroup.yaml file: |
108 | | -``` |
109 | | -haproxy: |
110 | | - service: |
111 | | - type: LoadBalancer |
112 | | -``` |
| 65 | + kubectl get secret single-node-admin -o jsonpath='{.data.wallet-password}' | base64 --decode |
| 66 | + ``` |
113 | 67 |
|
114 | | -> [!WARNING] |
115 | | -> Please note, by setting the haproxy service type to LoadBalancer, the MarkLogic endpoint is exposed to the public internet. Because of this, networkPolicy should be set to limit the sources that can visit MarkLogic. |
| 68 | +Please note that if configurations are provided for both the cluster and the group, the values specified for the cluster will take precedence and be applied. |
| 69 | +For additional manifests to deploy a MarkLogic cluster inside a Kubernetes cluster, see [Operator manifest](https://docs.progress.com/bundle/marklogic-server-on-kubernetes/operator/Operator-manifest.html) in the documentation. |
116 | 70 |
|
117 | | -## Deployment with TLS Enabled |
118 | | -The MarkLogic Kubernetes Operator supports installing MarkLogic with HTTPS enabled on the default app servers. The default app servers are App-Services (8000), Admin (8001), and Manage (8002) |
119 | | -### Choose the type of certificate |
120 | | -Two types of certificates are supported: standard certificates and temporary certificates. |
121 | | -* Temporary Certificates - A temporary certificate is ideal for development purposes. When using a temporary certificate for MarkLogic App Servers, a signed certificate does not need to be supplied. The certificate will be generated automatically. |
122 | | -* Standard Certificates - A standard certificate is issued by a trusted Certificate Authority (CA) for a specific domain (host name for MarkLogic server). A standard certificate is strongly recommended for production environments. Support is provided for both named certificates and wildcard certificates. |
123 | | - + Named Certificate - Each host must possess a designated certificate with a matching common name (CN). |
124 | | - + Wildcard Certificate - A single wildcard certificate can be used for all hosts within a cluster. |
| 71 | +## Clean Up |
125 | 72 |
|
126 | | -### Configure a MarkLogic cluster with a temporary certificate |
127 | | -To configure a temporary certificate, simply add the following option to CR yaml file: |
128 | | -``` |
129 | | -tls: |
130 | | - enableOnDefaultAppServers: true |
| 73 | +#### Cleaning up MarkLogic Cluster |
| 74 | +Use these steps to delete MarkLogic cluster and other resources created from the manifests used in the above [step](#install-marklogic-cluster). |
| 75 | +```sh |
| 76 | +kubectl delete -f quick_start.yaml |
131 | 77 | ``` |
132 | 78 |
|
133 | | -### Configure a MarkLogic cluster with a standard certificate |
134 | | -To configure a MarkLogic cluster with a standard certificate, follow these steps: |
135 | | -1. Obtain a certificate with a common name matching the hostname of the MarkLogic host. The certificate must be signed by a trusted Certificate Authority (CA). Either a publicly rooted CA or a private CA can be used. This example uses a private CA and a 2-node cluster. |
136 | | -2. Use this script to generate a self-signed CA certificate with openSSL. The script will create ca-private-key.pem as the CA key and cacert.pem as the private CA certificate: |
137 | | -``` |
138 | | -# Generate private key for CA |
139 | | -openssl genrsa -out ca-private-key.pem 2048 |
140 | | - |
141 | | -# Generate the self-signed CA certificate |
142 | | -openssl req -new -x509 -days 3650 -key ca-private-key.pem -out cacert.pem |
143 | | -``` |
144 | | -3. Use the script below to generate a private key and CSR for the marklogic-0 pod. After running the script, tls.key is generated as a private key and a host certificate for the marklogic-0 pod. |
145 | | ->Note: The filename for the private key must be tls.key and the filename for host certificate must be tls.crt. |
146 | | -* If the release name is "marklogic", then the host name for the marklogic-0 pod will be "marklogic-0.marklogic.default.svc.cluster.local". |
147 | | -* The host name for the marklogic-1 pod will be "marklogic-1.marklogic.default.svc.cluster.local". |
148 | | -``` |
149 | | -# Create private key |
150 | | -openssl genpkey -algorithm RSA -out tls.key |
151 | | - |
152 | | -# Create CSR for marklogic-0 |
153 | | -# Use marklogic-0.marklogic.default.svc.cluster.local as Common Name(CN) for CSR |
154 | | -openssl req -new -key tls.key -out tls.csr |
155 | | - |
156 | | -# Sign CSR with private CA |
157 | | -openssl x509 -req -CA cacert.pem -CAkey ca-private-key.pem -in tls.csr -out tls.crt -days 365 |
158 | | -``` |
159 | | -4. Use this script below to generate secrets for the host certificate and the CA certificate. Repeat these steps to generate the certificate for the marklogic-1 host and create the secret marklogic-1-cert. After running the script, secretes are created for marklogic-0 and marklogic-1. One secret is also created for the private CA certificate. |
160 | | -``` |
161 | | -# Generate Secret for marklogic-0 host certificate |
162 | | -kubectl create secret generic marklogic-0-cert --from-file=tls.crt --from-file=tls.key |
163 | | - |
164 | | -# Generate Secret for private CA certificate |
165 | | -kubectl create secret generic ca-cert --from-file=cacert.pem |
166 | | -``` |
167 | | -1. Once the certificate is created within Kubernetes secrets, add the following section to the CR yaml file and follow the instructions outlined in Install the Operator. |
168 | | -``` |
169 | | -tls: |
170 | | - enableOnDefaultAppServers: true |
171 | | - certSecretNames: |
172 | | - - "marklogic-0-cert" |
173 | | - - "marklogic-1-cert" |
174 | | - caSecretName: "ca-cert" |
| 79 | +#### Deleting Helm chart |
| 80 | +Use these steps to delete MarkLogic Operator Helm chart. |
| 81 | +```sh |
| 82 | +helm delete marklogic-operator-kubernetes |
175 | 83 | ``` |
176 | 84 |
|
177 | | - |
178 | | - |
179 | 85 | ## Known Issues and Limitations |
180 | 86 |
|
181 | | -1. The latest released version of fluent/fluent-bit:3.2.5 has known high and critical security vulnerabilities. If you decide to enable the log collection feature, choose and deploy the fluent-bit or an alternate image with no vulnerabilities as per your requirements. |
182 | | -2. Known Issues and Limitations for the MarkLogic Server Docker image can be viewed using the link: https://github.com/marklogic/marklogic-docker?tab=readme-ov-file#Known-Issues-and-Limitations. |
| 87 | +1. The latest released version of fluent/fluent-bit:3.2.5 has high and critical security vulnerabilities. If you decide to enable the log collection feature, choose and deploy the fluent-bit or an alternate image with no vulnerabilities as per your requirements. |
| 88 | +2. Known Issues and Limitations for the MarkLogic Server Docker image can be viewed using the link: https://github.com/marklogic/marklogic-docker?tab=readme-ov-file#Known-Issues-and-Limitations. |
| 89 | +3. If you're updating the group name configuration, ensure that you delete the pod to apply the changes, as we are using the OnDelete upgrade strategy. |
0 commit comments