-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes on load balancer - complete readme, some variables and...
- Loading branch information
Maziar
committed
Jun 15, 2021
1 parent
a9d1992
commit 18b810e
Showing
9 changed files
with
171 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,86 @@ You should have your **Kubernetes** cluster installed and configured and then yo | |
|
||
As Arc is an API gateway for your Elasticsearch, make sure that you already have an Elasticsearch cluster with it's basic credentials. | ||
|
||
If you don't have an Elasticsearch cluster, you can use this [guid]("https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-quickstart.html") | ||
If you don't have an Elasticsearch cluster, you can use this [guide]("https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-quickstart.html") | ||
|
||
## Quick start | ||
## Why Helm Charts: | ||
|
||
Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application. | ||
|
||
Charts are easy to create, version, share, and publish — so start using Helm and stop the copy-and-paste. | ||
|
||
Here we get benefit of Helm Charts to package Arc (which is an API Gateway that sits between a client and an ElasticSearch cluster) and install it in seconds. | ||
|
||
## How to install Appbaseio Helm Chart | ||
|
||
1- run `helm repo add appbase` | ||
|
||
2- run `helm install appbase --set <variables>` | ||
|
||
Make sure that you set below variables which are mandatory: | ||
|
||
- `elasticsearch.clusterURL` | ||
|
||
- `appbase.id` | ||
|
||
- `appbase.username` :if you don't set this variable, by default will be set as "admin" | ||
- `appbase.password` :if you don't set this variable, by default will be set as "admin" | ||
|
||
|
||
## Configure the cluster with Values | ||
|
||
According to Helm chart [values]("https://helm.sh/docs/chart_template_guide/values_files/") you can customize the cluster in the way you want by set variables during the install. | ||
We categorized variables in order to ease it's readability, for example `elasticsearch.clusterURL` means clusterURL is a subset of elasticsearch but while setting a vaiable we should follo it's indentation. | ||
Here are the variables you can set for your cluster: | ||
| Name |Default Value | Kind | Description | | ||
|---|---|---|---| | ||
| elasticsearch.clusterURL | "" | String | clusterURL based on basic authentication. fluent-bit splites this clusterURL soit should be in following pattern: "http://<user>:<password>@domain:port" ( Prtotocol Can also be -> https) | | ||
| arc.name | arc | String | It's the name of Arc service which you can use to access your application via service name | | ||
| arc.image | appbaseio/arc | String | This is the image Appbase.io provides as gateway for your elasticsearch, if you have your local repository, you can push Arc image into that then change the URL here. | | ||
| arc.port | 8000 | Integer | The port that used for Arc service | | ||
| appbase.id | "" | String | This is **APPBASE_ID** that you can get from [Appbase.io]("https://arc-dashboard.appbase.io/install") | | ||
| appbase.username | admin | String | This is the username you choose for your Appbaseio | | ||
| appbase.password | admin | String | This is the password you choose for your Appbaseio | | ||
| appbase.domain | "" | String | If you are installing helm chart on your production and want to assigne a domain to it, set this variable to your domain, make sure that your loadBalancer.serviceType to be empty ("") | | ||
| volume.name | pv | String | If you want to use default volume, leave name empty but if you want to use your Persistent volume, enter it's name, the PVC ( persistent volume claim) will be assigned to it | | ||
| volume.storageClassName | standard | String | Your Storage class which should be the same with PVC, if you have a specific class for your Volume, set that here to also be set for PVC | | ||
| volume.accessModes | ReadWriteMany | String | Access mode for volume | | ||
| volume.storageSize | 1Gi | String | This is the size of PVC storage, Default volume size is 5Gi which you can handle how much of it be assigned to PVC | | ||
| volume.pvcName | pvc | String | You can change PVC (Persitent Volume Claim) name here, it's assigned to PV(Persistent Volume) | | ||
| cert.name | ssl | String | you can add your certificate here by configuring below values. name is the name of secret file containing your certificate information, if you have your own secret file, you can only fill the name value and leave the other empty | | ||
| cert.tlsCrt | "" | String | "tlsCrt" is your "tls.crt" | | ||
| cert.tlsKey | "" | String | "tlsKey" is "tls.key" | | ||
| cert.caCrt | "" | String | "caCrt" is "ca.crt" | | ||
| loadBalancer.serviceType | "" | String |If yo're using kubernetes locally and as you won't have external IP, Can be "NodePort" but if it's your production kubernetes, you can leave it empty which means serviceType is : "LoadBalancer"| | ||
|
||
**Tips:** | ||
|
||
- Some variables might be long to use in install command, so you can export it and then use it e.g. | ||
|
||
`export $(ES_ClusterURL=<your elasticsearch URL with basec authentication>)` | ||
|
||
then you can use it while installing helm: | ||
|
||
`helm install appbase --set elasticsearch.clusterURL=ES_ClusterURL` | ||
|
||
## Kubernetes Distribution support: | ||
You can check [this page]("https://helm.sh/docs/topics/kubernetes_distros/") to see what distros Helm is currently supporting | ||
## Test on Minikube | ||
|
||
1- Make sure your Minikube is installed, if not, use [this]("https://minikube.sigs.k8s.io/docs/start/") and if you don't have kubectl installed, use this [link]("https://kubernetes.io/docs/tasks/tools/") | ||
|
||
2- Add Appbase helm repo and install it as it's said | ||
|
||
Make sure that you set loadBalancer.serviceType=NodePort | ||
|
||
3- After you install helm chart setting loadBalancer.serviceType=NodePort, you will see this result: | ||
 | ||
|
||
Which you can use the command to get access to your Appbaseio service | ||
|
||
If you changr arc.name, the command will be: minikube service --url <arc name>-nodeport | ||
|
||
## How to use it by cloning the project | ||
1- Clone this repositoy: | ||
|
||
`git clone [email protected]:appbaseio/helm-charts.git` | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,6 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if eq .Values.loadBalancer.serviceType "NodePort"}} | ||
Use below command to connect to get appbaseio Access URL: | ||
minikube service --url {{ .Values.arc.name }}-nodeport | ||
|
||
{{- if contains "NodePort" .Values.arc.serviceType }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Values.arc.name }} }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.arc.serviceType}} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ .Values.arc.name}}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ .Values.arc.name }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.arc.port }} | ||
{{- else if contains "ClusterIP" .Values.arc.serviceType }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ .Values.arc.name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} | ||
** If you're not using minikube, you can set loadBalancer.serviceType to "LoadBalancer" | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{ if eq .Values.loadBalancer.serviceType "NodePort" }} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.arc.name }}-nodeport | ||
spec: | ||
type: NodePort | ||
selector: | ||
app: {{ .Values.arc.name }} | ||
ports: | ||
# By default and for convenience, the `targetPort` is set to the same value as the `port` field. | ||
- port: 80 | ||
targetPort: 8000 | ||
# Optional field | ||
# By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767) | ||
nodePort: 30077 | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.