我正在尝试让online-auction-scala
在GCP上运行。我现在唯一想念的就是让ingress
工作。 search
服务的运行状况检查报告UNHEALTHY
的状态,尽管search
服务已启动并正在运行,并且日志中没有错误。
构建Docker映像并将其发布到Docker注册表后要做的步骤:
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
reactive-sandbox
准备就绪时,我正在运行KUBERNATES.md
文件中的脚本。
#
# 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 -
任何帮助将不胜感激。
答案 0 :(得分:1)
谢谢帕特里克,我弄清楚了为什么入口显示出不健康的状态。这是因为它试图从/路径获取它,并在该服务中返回了404状态代码。我必须执行该操作才能在该路径上返回200,从而解决了该问题。