I'm trying to get online-auction-scala
running on GCP. The only thing I miss now is getting ingress
working. The health check from search
service reports UNHEALTHY
status, although search
service is up and running and there are no errors in it's logs.
The steps I do after building docker images and publishing them to docker registry:
gcloud container clusters create mt-develop
gcloud container clusters get-credentials mt-develop
kubectl create serviceaccount tiller --namespace kube-system
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
helm install lightbend-helm-charts/reactive-sandbox --name reactive-sandbox
PRIMARY_ACCOUNT=$(gcloud info --format='value(config.account)')
kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$PRIMARY_ACCOUNT
kubectl apply -f RBAC.yml
when the reactive-sandbox
is ready, I'm running the script from KUBERNATES.md
file.
#
# NOTE: You must change the secret values below or the applications will crash.
#
# These values are used for Play's application secret. It is important that they are set to a secret value.
# More information: https://www.playframework.com/documentation/latest/ApplicationSecret
secret_bidding=Secret123
secret_item=Secret123
secret_user=Secret123
secret_search=Secret123
secret_web=Secret123
# Configure Play's Allowed Hosts filter.
# More information: https://www.playframework.com/documentation/latest/AllowedHostsFilter
allowed_host=.
# Default addresses for reactive-sandbox, which provides Cassandra, Kafka, Elasticsearch
export service_cassandra=_cql._tcp.reactive-sandbox-cassandra.default.svc.cluster.local
export service_kafka=_broker._tcp.reactive-sandbox-kafka.default.svc.cluster.local
export service_elasticsearch=_http._tcp.reactive-sandbox-elasticsearch.default.svc.cluster.local
# Deploy bidding-impl
rp generate-kubernetes-resources registry.mydomain.com/trg/biddingimpl:1.0.0-SNAPSHOT \
--generate-pod-controllers --generate-services --service-type="NodePort" \
--env JAVA_OPTS="-Dplay.http.secret.key=$secret_bidding -Dplay.filters.hosts.allowed.0=$allowed_host" \
--pod-controller-replicas 2 \
--external-service "cas_native=$service_cassandra" \
--external-service "kafka_native=$service_kafka" | kubectl apply -f -
# Deploy item-impl
rp generate-kubernetes-resources registry.mydomain.com/trg/itemimpl:1.0.0-SNAPSHOT \
--generate-pod-controllers --generate-services --service-type="NodePort" \
--env JAVA_OPTS="-Dplay.http.secret.key=$secret_item -Dplay.filters.hosts.allowed.0=$allowed_host" \
--pod-controller-replicas 2 \
--external-service "cas_native=$service_cassandra" \
--external-service "kafka_native=$service_kafka" | kubectl apply -f -
# Deploy user-impl
rp generate-kubernetes-resources registry.mydomain.com/trg/userimpl:1.0.0-SNAPSHOT \
--generate-pod-controllers --generate-services --service-type="NodePort" \
--env JAVA_OPTS="-Dplay.http.secret.key=$secret_user -Dplay.filters.hosts.allowed.0=$allowed_host" \
--pod-controller-replicas 2 \
--external-service "cas_native=$service_cassandra" \
--external-service "kafka_native=$service_kafka" | kubectl apply -f -
# Deploy search-impl
rp generate-kubernetes-resources registry.mydomain.com/trg/searchimpl:1.0.0-SNAPSHOT \
--generate-pod-controllers --generate-services --service-type="NodePort" \
--env JAVA_OPTS="-Dplay.http.secret.key=$secret_search -Dplay.filters.hosts.allowed.0=$allowed_host" \
--pod-controller-replicas 2 \
--external-service "cas_native=$service_cassandra" \
--external-service "kafka_native=$service_kafka" \
--external-service "elastic-search=$service_elasticsearch" | kubectl apply -f -
# Deploy webgateway
rp generate-kubernetes-resources registry.mydomain.com/trg/webgateway:1.0.0-SNAPSHOT \
--service-type="NodePort" \
--generate-pod-controllers --generate-services \
--env JAVA_OPTS="-Dplay.http.secret.key=$secret_web -Dplay.filters.hosts.allowed.0=$allowed_host" | kubectl apply -f -
# Deploy ingress for everything
# Note that some environments, such as IBM Cloud and Google Kubernetes Engine have slightly different nginx
# implementations. For these, you may need to specify `--ingress-path-suffix '*'` or `--ingress-path-suffix '.*'` as
# part of the command below.
rp generate-kubernetes-resources \
--generate-ingress --ingress-name online-auction \
registry.mydomain.com/trg/webgateway:1.0.0-SNAPSHOT \
registry.mydomain.com/trg/searchimpl:1.0.0-SNAPSHOT \
registry.mydomain.com/trg/userimpl:1.0.0-SNAPSHOT \
registry.mydomain.com/trg/itemimpl:1.0.0-SNAPSHOT \
registry.mydomain.com/trg/biddingimpl:1.0.0-SNAPSHOT | kubectl apply -f -
Any help would be much appreciated.
Thanks Patrick, I figured out why ingress was showing a not healthy state. It was because it tried to get it from / path and in that service, it was returning 404 status code. I had to implement that to return 200 on that path and that solved the issue.