3939## deploying the IAP proxy
4040To deploy the IAP proxy for GKE, type:
4141
42- ```
43- $ git clone https://github.com/binxio/simple-iap-proxy.git
44- $ cp .auto.tfvars simple-iap-proxy/terraform
45- $ terraform init
46- $ terraform apply
42+ ``` sh
43+ git clone https://github.com/binxio/simple-iap-proxy.git
44+ cp .auto.tfvars simple-iap-proxy/terraform
45+ terraform init
46+ terraform apply
4747```
4848
4949After the apply, the required IAP proxy command is printed:
5050```
5151iap_proxy_command = <<EOT
52- simple-iap-proxy client \
52+ simple-iap-proxy gke- client \
5353 --target-url https://iap-proxy.google.binx.dev \
5454 --iap-audience 712731707077-j9onig1ofcgle7iogv8fceu04v8hriuv.apps.googleusercontent.com \
55- --service-account iap-proxy-accessor@speeltuin-mvanholsteijn.iam.gserviceaccount.com
55+ --service-account iap-proxy-accessor@speeltuin-mvanholsteijn.iam.gserviceaccount.com \
56+ --key-file server.key \
57+ --certificate-file server.crt
5658
5759EOT
5860```
5961
6062## start the IAP proxy
6163To start the IAP proxy, you need a certificate. To generate a self-signed certificate, type:
6264
63- ``` shell-terminal
64- $ openssl genrsa -out server.key 2048
65- $ openssl req -new -x509 -sha256 \
65+ ``` bash
66+ openssl genrsa -out server.key 2048
67+ openssl req -new -x509 -sha256 \
6668 -key server.key \
6769 -subj " /CN=localhost" \
6870 -addext " subjectAltName = DNS:localhost" \
6971 -days 3650 \
7072 -out server.crt
7173```
7274
73- To trust the proxy, type:
75+ To trust the proxy, you add the certificate to the trust store. On MacOs, type:
7476
75- ```
77+ ``` bash
7678sudo security add-trusted-cert -d -p ssl -p basic -k /Library/Keychains/System.keychain ./server.crt
7779```
7880
81+ On Linux, type:
82+
83+ ``` sh
84+ cp server.crt /etc/ssl/certs/
85+ c_rehash
86+ ```
87+
7988
8089Now you can start the proxy, by copying the outputted command:
8190
82- ``` shell-terminal
91+ ``` sh
8392$ go install github.com/binxio/
[email protected] 8493$ terraform output -raw iap_proxy_command | sh
8594```
@@ -88,15 +97,15 @@ The reason for the self-signed certificate is that kubectl will not send the cre
8897## get credentials for your cluster
8998To get the credentials for your cluster, type:
9099
91- ``` shell-terminal
100+ ``` sh
92101$ gcloud container clusters \
93102 get-credentials cluster-1
94103````
95104
96105# # configure kubectl access via IAP proxy
97106To configure the kubectl access via the IAP proxy, type:
98107
99- ```$shell-terminal
108+ ` ` ` sh
100109gcloud container clusters \
101110 get-credentials cluster-1
102111
@@ -110,10 +119,12 @@ This points the context to the proxy and configure the self-signed certificate f
110119# # use kubectl over IAP
111120Now you can use kubectl over IAP!
112121
113- ``` shell-terminal
122+ ` ` ` sh
114123$ kubectl cluster-info dump
115124` ` `
116125
117- ## todo
118- - upgrading to websockets is not supported (ie kubectl exec)
119- - deploy across multiple regions
126+ # # Caveats
127+ - The IAP protocol does not support websockets as Authorization header cannot be passed in. Commands which rely
128+ on websockets will fail (ie kubectl exec).
129+ - the --debug flag is not very verbose.
130+ - The proxy has not been tested yet in the field, so I am happy to hear your feedback!
0 commit comments