Skip to content

Commit 0d938d0

Browse files
authored
Merge pull request #6015 from RainbowMango/pr_docs_operator_expose
Add docs for exposing Karmada APIServer provisioned by operator
2 parents 72b6bd7 + c9ef503 commit 0d938d0

File tree

1 file changed

+56
-6
lines changed

1 file changed

+56
-6
lines changed

operator/README.md

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ you can run the following command before performing the deletion operation.
162162
kubectl label karmada karmada-demo -n test operator.karmada.io/disable-cascading-deletion=true
163163
```
164164

165-
### Custom Karmada CR
165+
## Custom Karmada CR
166166

167167
This feature allows you to configure the Karmada CR to install Karmada instances flexibly.
168168
For details, see [karmada.yaml](./config/samples/karmada.yaml).
169169

170-
#### Set Karmada component replicas
170+
### Set Karmada component replicas
171171

172172
The `replicas` of all Karmada components can be modified.
173173
For example, you can scale the etcd pod `replicas` to 3:
@@ -185,7 +185,7 @@ spec:
185185
replicas: 3
186186
```
187187
188-
#### Custom label and annotation
188+
### Custom label and annotation
189189
190190
All Karmada components allow for custom labels and annotations to be set.
191191
These are merged into both pod and workload resources.
@@ -205,7 +205,7 @@ spec:
205205
<custom-annotation-key>: <custom-annotation-value>
206206
```
207207
208-
#### Change karmada-apiserver service type
208+
### Change karmada-apiserver service type
209209
210210
The service type of karmada-apiserver is `ClusterIP` by default.
211211
You can change it to `NodePort`:
@@ -221,7 +221,7 @@ karmadaAPIServer:
221221
...
222222
```
223223

224-
#### Add karmada-apiserver SANs
224+
### Add karmada-apiserver SANs
225225

226226
You can add more SANs to karmada-apiserver certificate:
227227

@@ -238,7 +238,7 @@ karmadaAPIServer:
238238
...
239239
```
240240

241-
#### Install karmada addon
241+
### Install karmada addon
242242

243243
By default, the Karmada operator does not install the `descheduler` and `search` addons.
244244
If you want to use them, you should add definitions to the Karmada CR.
@@ -257,6 +257,56 @@ spec:
257257

258258
If you want to install with the defaults, simply define an empty struct for `descheduler`.
259259

260+
### Expose Karmada API Server
261+
By default, the Karmada API Server's Service type is set to `ClusterIP`, which means it can only be accessed within
262+
the Kubernetes cluster. If you wish to access the Karmada API Server from outside the cluster, there are several
263+
methods to expose it. The following will introduce these methods and provide the necessary configuration steps.
264+
265+
#### Using a LoadBalancer Service Type
266+
If your Kubernetes cluster runs on a cloud provider that supports LoadBalancer (such as AWS, GCP, Azure, etc.),
267+
you can change the Karmada API Server's Service type to `LoadBalancer`. This will automatically allocate or use an
268+
external IP address for the Karmada API Server, allowing you to access it from outside the cluster.
269+
270+
#### Using a NodePort Service Type
271+
You also can change the Karmada API Server's Service type to `NodePort`. This exposes the Karmada API Server on a
272+
specific port on each node, allowing you to access it via any node's IP address and that port.
273+
274+
#### Using an Ingress Controller
275+
If you already have an [Ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/)
276+
deployed in your cluster, you can create an `Ingress` resource to expose the Karmada API Server. The Ingress controller
277+
will route external traffic to the Karmada API Server's Service, enabling external access.
278+
279+
For example, you can create a following Ingress resource to route external traffic to the Karmada API Server:
280+
```yaml
281+
apiVersion: networking.k8s.io/v1
282+
kind: Ingress
283+
metadata:
284+
name: karmada-apiserver-ingress
285+
namespace: karmada-system
286+
annotations:
287+
nginx.ingress.kubernetes.io/ssl-passthrough: "true"
288+
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
289+
spec:
290+
ingressClassName: nginx
291+
rules:
292+
- host: karmada.example.com
293+
http:
294+
paths:
295+
- path: /
296+
pathType: Prefix
297+
backend:
298+
service:
299+
name: karmada-apiserver
300+
port:
301+
number: 443
302+
```
303+
304+
#### Using Port Forwarding
305+
If you only need temporary access to the Karmada API Server or prefer not to permanently expose it, you can use kubectl
306+
[port-forward](https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/) to
307+
forward a local port to the Karmada API Server's Pod. This method is ideal for development and debugging but is not
308+
recommended for production environments.
309+
260310
## Contributing
261311

262312
The `karmada/operator` repo is part of Karmada from 1.5 onwards. If you're interested in

0 commit comments

Comments
 (0)