|
| 1 | +CHART NAME: {{ .Chart.Name }} |
| 2 | +CHART VERSION: {{ .Chart.Version }} |
| 3 | +APP VERSION: {{ .Chart.AppVersion }} |
| 4 | + |
| 5 | +** Please be patient while the chart is being deployed ** |
| 6 | + |
| 7 | +{{- if .Values.diagnosticMode.enabled }} |
| 8 | +The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with: |
| 9 | + |
| 10 | + command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }} |
| 11 | + args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }} |
| 12 | + |
| 13 | +Get the list of pods by executing: |
| 14 | + |
| 15 | + kubectl get pods --namespace {{ include "common.names.namespace" . }} -l app.kubernetes.io/instance={{ .Release.Name }} |
| 16 | + |
| 17 | +Access the pod you want to debug by executing |
| 18 | + |
| 19 | + kubectl exec --namespace {{ include "common.names.namespace" . }} -ti <NAME OF THE POD> -- bash |
| 20 | + |
| 21 | +In order to replicate the container startup scripts execute this command: |
| 22 | + |
| 23 | + /opt/bitnami/scripts/spark/entrypoint.sh /opt/bitnami/scripts/spark/run.sh |
| 24 | + |
| 25 | +{{- else }} |
| 26 | + |
| 27 | +1. Get the Spark master WebUI URL by running these commands: |
| 28 | +{{- if .Values.ingress.enabled }} |
| 29 | + |
| 30 | + export HOSTNAME=$(kubectl get ingress --namespace {{ include "common.names.namespace" . }} {{ printf "%s-ingress" (include "common.names.fullname" .) }} -o jsonpath='{.spec.rules[0].host}') |
| 31 | + echo "Spark-master URL: http://$HOSTNAME/" |
| 32 | + |
| 33 | +{{- else -}} |
| 34 | +{{- if contains "NodePort" .Values.service.type }} |
| 35 | + |
| 36 | + export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='http')].nodePort}" services {{ printf "%s-master-svc" (include "common.names.fullname" .) }}) |
| 37 | + export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") |
| 38 | + echo http://$NODE_IP:$NODE_PORT |
| 39 | + |
| 40 | +{{- else if contains "LoadBalancer" .Values.service.type }} |
| 41 | + |
| 42 | + NOTE: It may take a few minutes for the LoadBalancer IP to be available. |
| 43 | + You can watch the status of by running 'kubectl get --namespace {{ include "common.names.namespace" . }} svc -w {{ printf "%s-master-svc" (include "common.names.fullname" .) }}' |
| 44 | + |
| 45 | + export SERVICE_IP=$(kubectl get --namespace {{ include "common.names.namespace" . }} svc {{ printf "%s-master-svc" (include "common.names.fullname" .) }} -o jsonpath="{.status.loadBalancer.ingress[0]['ip', 'hostname'] }") |
| 46 | + echo http://$SERVICE_IP:{{ .Values.service.ports.http }} |
| 47 | + |
| 48 | +{{- else if contains "ClusterIP" .Values.service.type }} |
| 49 | + |
| 50 | + kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ printf "%s-master-svc" (include "common.names.fullname" .) }} {{ default "80" .Values.service.ports.http }}:{{ default "80" .Values.service.ports.http }} |
| 51 | + echo "Visit http://127.0.0.1:{{ .Values.service.ports.http }} to use your application" |
| 52 | + |
| 53 | +{{- end }} |
| 54 | +{{- end }} |
| 55 | + |
| 56 | +2. Submit an application to the cluster: |
| 57 | + |
| 58 | + To submit an application to the cluster the spark-submit script must be used. That script can be |
| 59 | + obtained at https://github.com/apache/spark/tree/master/bin. Also you can use kubectl run. |
| 60 | + |
| 61 | +{{- if or (eq "NodePort" .Values.service.type) (eq "LoadBalancer" .Values.service.type) }} |
| 62 | + |
| 63 | + Run the commands below to obtain the master IP and submit your application. |
| 64 | +{{- end }} |
| 65 | + |
| 66 | + export EXAMPLE_JAR=$(kubectl exec -ti --namespace {{ include "common.names.namespace" . }} {{ printf "%s-worker-0" (include "common.names.fullname" .) }} -- find examples/jars/ -name 'spark-example*\.jar' | tr -d '\r') |
| 67 | +{{- if eq "NodePort" .Values.service.type }} |
| 68 | + export SUBMIT_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[?(@.name=='cluster')].nodePort}" services {{ printf "%s-master-svc" (include "common.names.fullname" .) }}) |
| 69 | + export SUBMIT_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") |
| 70 | + |
| 71 | + kubectl run --namespace {{ include "common.names.namespace" . }} {{ printf "%s-client" (include "common.names.fullname" .) }} --rm --tty -i --restart='Never' \ |
| 72 | + --image {{ template "spark.image" . }} \ |
| 73 | + -- spark-submit --master spark://$SUBMIT_IP:$SUBMIT_PORT \ |
| 74 | + --class org.apache.spark.examples.SparkPi \ |
| 75 | + --deploy-mode cluster \ |
| 76 | + $EXAMPLE_JAR 1000 |
| 77 | + |
| 78 | +{{- else if eq "LoadBalancer" .Values.service.type }} |
| 79 | + export SUBMIT_IP=$(kubectl get --namespace {{ include "common.names.namespace" . }} svc {{ printf "%s-master-svc" (include "common.names.fullname" .) }} -o jsonpath="{.status.loadBalancer.ingress[0]['ip', 'hostname'] }") |
| 80 | + |
| 81 | + kubectl run --namespace {{ include "common.names.namespace" . }} {{ printf "%s-client" (include "common.names.fullname" .) }} --rm --tty -i --restart='Never' \ |
| 82 | + --image {{ template "spark.image" . }} \ |
| 83 | + -- spark-submit --master spark://$SUBMIT_IP:{{ .Values.service.ports.cluster }} \ |
| 84 | + --deploy-mode cluster \ |
| 85 | + --class org.apache.spark.examples.SparkPi \ |
| 86 | + $EXAMPLE_JAR 1000 |
| 87 | + |
| 88 | +{{- else }} |
| 89 | + |
| 90 | + kubectl exec -ti --namespace {{ include "common.names.namespace" . }} {{ printf "%s-worker-0" (include "common.names.fullname" .) }} -- spark-submit --master spark://{{ printf "%s-master-svc" (include "common.names.fullname" .) }}:{{ .Values.service.ports.cluster }} \ |
| 91 | + --class org.apache.spark.examples.SparkPi \ |
| 92 | + $EXAMPLE_JAR 5 |
| 93 | + |
| 94 | +** IMPORTANT: When submit an application from outside the cluster service type should be set to the NodePort or LoadBalancer. ** |
| 95 | + |
| 96 | +{{- end }} |
| 97 | + |
| 98 | +** IMPORTANT: When submit an application the --master parameter should be set to the service IP, if not, the application will not resolve the master. ** |
| 99 | +{{- end }} |
| 100 | + |
| 101 | +{{ include "spark.checkRollingTags" . }} |
| 102 | +{{ include "spark.validateValues" . }} |
0 commit comments