kelseyhightower / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way. No scripts.
Apache License 2.0
41.03k stars 14.05k forks source link

Create the external load balancer network resources step #497

Open organicnz opened 5 years ago

organicnz commented 5 years ago

Create the external load balancer network resources step drops these errors.

organic@controller-0:~$ {
>   KUBERNETES_PUBLIC_ADDRESS=$(gcloud compute addresses describe kubernetes-the-hard-way \
>     --region $(gcloud config get-value compute/region) \
>     --format 'value(address)')
>
>   gcloud compute http-health-checks create kubernetes \
>     --description "Kubernetes Health Check" \
>     --host "kubernetes.default.svc.cluster.local" \
>     --request-path "/healthz"
>
>   gcloud compute firewall-rules create kubernetes-the-hard-way-allow-health-check \
>     --network kubernetes-the-hard-way \
>     --source-ranges 209.85.152.0/22,209.85.204.0/22,35.191.0.0/16 \
>     --allow tcp
>
>   gcloud compute target-pools create kubernetes-target-pool \
>     --http-health-check kubernetes
>
>   gcloud compute target-pools add-instances kubernetes-target-pool \
>    --instances controller-0,controller-1,controller-2
>
>   gcloud compute forwarding-rules create kubernetes-forwarding-rule \
>     --address ${KUBERNETES_PUBLIC_ADDRESS} \
>     --ports 6443 \
>     --region $(gcloud config get-value compute/region) \
>     --target-pool kubernetes-target-pool
> }
(unset)
ERROR: (gcloud.compute.addresses.describe) argument --region: expected one argument
Usage: gcloud compute addresses describe NAME [optional flags]
  optional flags may be  --global | --help | --region

For detailed information on this command and its flags, run:
  gcloud compute addresses describe --help
ERROR: (gcloud.compute.http-health-checks.create) Could not fetch resource:
 - The resource 'projects/vivid-case-256218/global/httpHealthChecks/kubernetes' already exists

Creating firewall...failed.
ERROR: (gcloud.compute.firewall-rules.create) Could not fetch resource:
 - The resource 'projects/vivid-case-256218/global/firewalls/kubernetes-the-hard-way-allow-health-check' already exists

Did you mean region [us-west1] for target pool:
[kubernetes-target-pool] (Y/n)?  y

ERROR: (gcloud.compute.target-pools.create) Could not fetch resource:
 - The resource 'projects/vivid-case-256218/regions/us-west1/targetPools/kubernetes-target-pool' already exists

Did you mean zone [us-west1-c] for instance: [controller-0,
controller-1, controller-2] (Y/n)?  y

Updated [https://www.googleapis.com/compute/v1/projects/vivid-case-256218/regions/us-west1/targetPools/kubernetes-target-pool].
(unset)
ERROR: (gcloud.compute.forwarding-rules.create) argument --address: expected one argument
Usage: gcloud compute forwarding-rules create NAME (--backend-service=BACKEND_SERVICE | --target-http-proxy=TARGET_HTTP_PROXY | --target-https-proxy=TARGET_HTTPS_PROXY | --target-instance=TARGET_INSTANCE | --target-pool=TARGET_POOL | --target-ssl-proxy=TARGET_SSL_PROXY | --target-tcp-proxy=TARGET_TCP_PROXY | --target-vpn-gateway=TARGET_VPN_GATEWAY) [optional flags]
  optional flags may be  --address | --address-region | --backend-service |
                         --backend-service-region | --description | --global |
                         --global-address | --global-backend-service | --help |
                         --ip-protocol | --ip-version |
                         --load-balancing-scheme | --network | --network-tier |
                         --port-range | --ports | --region | --service-label |
                         --subnet | --subnet-region | --target-http-proxy |
                         --target-https-proxy | --target-instance |
                         --target-instance-zone | --target-pool |
                         --target-pool-region | --target-ssl-proxy |
                         --target-tcp-proxy | --target-vpn-gateway |
                         --target-vpn-gateway-region

For detailed information on this command and its flags, run:
  gcloud compute forwarding-rules create --help
hmanikkothu commented 5 years ago

Seems like you already have the 'kubernetes-target-pool' created, so you could try deleting the same via commandline, or go to the GCP dashboard, search for it and delete.

jstoveld commented 4 years ago

I have a similar problem here.

Here is my output:

johns-mbp:~ jstoveld$ gcloud compute addresses create kubernetes-the-hard-way   --region $(gcloud config get-value compute/region)
(unset)
ERROR: (gcloud.compute.addresses.create) argument --region: expected one argument
Usage: gcloud compute addresses create [NAME ...] [optional flags]
  optional flags may be  --addresses | --description | --global | --help |
                         --ip-version | --network | --network-tier |
                         --prefix-length | --purpose | --region | --subnet

For detailed information on this command and its flags, run:
  gcloud compute addresses create --help
johns-mbp:~ jstoveld$ 
kormotodor commented 4 years ago

@organicnz looks like you are trying to create LB resource from controller instance instead of local machine:

organic@controller-0:~$ {

Note that:

The compute instances created in this tutorial will not have permission to complete this section. Run the following commands from the same machine used to create the compute instances.

(https://github.com/kelseyhightower/kubernetes-the-hard-way/blame/master/docs/08-bootstrapping-kubernetes-controllers.md#L345)