I'm a bit new at google cloud deployment but I'm currently trying to set up a external http loadbalancer with yaml in google cloud deployment manager. The loadbalancer uses a healthcheck but when I try to redirect to where my healthcheck is it gives an error that it can't find it.
I tried to create the healthcheck manually in the console but it still says it can't find it.
I've gone over the documentation here https://cloud.google.com/compute/docs/reference/rest/v1/backendServices and here https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks and it looks like it should be working but it don't.
I have also searched on google and stack overflow for an answer but haven't found anything. I've also tried to use selflink to link to the healthcheck. But that won't work either. I feel like im missing something here.
- name: healthcheckpls
type: compute.v1.httpHealthCheck
properties:
port: 80
requestPath: /
- name: bes
type: compute.v1.backendService
properties:
port: 80
portName: http
protocol: HTTP
backends:
- name: bes
balancingMode: UTILIZATION
capacityScaler: 1.0
group: zones/us-central1-f/instanceGroups/instancegroup-1
maxUtilization: 0.8
connectionDraining:
drainingTimeoutSec: 300
healthChecks:
- global/httpHealthChecks/healthcheckpls
- name: apache-url-map
type: compute.v1.urlMap
properties:
defaultService: $(ref.bes.selfLink)
- name: apache-http-proxy
type: compute.v1.targetHttpProxy
properties:
urlMap: $(ref.apache-url-map.selfLink)
- name: apache-ipaddress
type: compute.v1.globalAddress
- name: apache-http-forwardingrule
type: compute.v1.globalForwardingRule
properties:
target: $(ref.apache-http-proxy.selfLink)
IPAddress: $(ref.apache-ipaddress.address)
IPProtocol: TCP
portRange: 80-80
Here is the Error I get from the deployment manager.
ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1606653109305-5b53e13db7fbd-7084e34a-f0444d0f]: errors:
- code: RESOURCE_ERROR
location: /deployments/lampdeployment/resources/bes
message: "{\"ResourceType\":\"compute.v1.backendService\",\"ResourceErrorCode\"\
:\"404\",\"ResourceErrorMessage\":{\"code\":404,\"errors\":[{\"domain\":\"global\"\
,\"message\":\"The resource 'projects/cloudautomation-296812/global/httpHealthChecks/healthcheckpls'\
\ was not found\",\"reason\":\"notFound\"}],\"message\":\"The resource 'projects/cloudautomation-296812/global/httpHealthChecks/healthcheckpls'\
\ was not found\",\"statusMessage\":\"Not Found\",\"requestPath\":\"https://compute.googleapis.com/compute/v1/projects/cloudautomation-296812/global/backendServices\"\
,\"httpMethod\":\"POST\"}}"
Am I missing something? Why isn't this working?
I'm very new at this so if there is something fundemental im missing I would also like to know :D
Thanks for the help guys! I really appreciate it.
After a lot of troubleshooting I got it. I had to use:
healthChecks:
- $(ref.healthcheckpls.selfLink)