Hi everyone, I have a running Flink deployment in...
# troubleshooting
r
Hi everyone, I have a running Flink deployment in K8s with stable version 1.18.1, everything works great! I have just configured SSL (internal and rest/external). Everything works as expected [internal and external (web ui, flink cli) ], except for the sql-client.sh. If just configure internal SSL all works great, i*t's only with the rest/internal SSL* i got sql-client issues!! The configuration was done using self-signed certs and its running in K8s. I have followed the exact instructions on https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/deployment/security/security-ssl/#example-ssl-setup-standalone-and-kubernetes just replacing the url by localhost and setting a no hostname validation. My security config is like the official example:
Copy code
# security
    security.ssl.internal.enabled: true
    security.ssl.rest.enabled: true
    
    # internal 
    security.ssl.internal.keystore: /opt/flink/ssl/internal.keystore
    security.ssl.internal.keystore-password: internal_store_password
    security.ssl.internal.key-password: internal_store_password
    security.ssl.internal.truststore: /opt/flink/ssl/internal.keystore
    security.ssl.internal.truststore-password: internal_store_password
    security.ssl.algorithms: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
    security.ssl.internal.cert.fingerprint: E6:2B:A1:C8:21:13:85:7B:0F:F3:4A:58:3E:D9:EC:B2:3B:70:59:EE

    # all by default
    taskmanager.data.ssl.enabled: true
    blob.service.ssl.enabled: true
    pekko.ssl.enabled: true

    # external / rest
    security.ssl.rest.keystore: /opt/flink/ssl/rest.signed.keystore
    security.ssl.rest.keystore-password: rest_keystore_password
    security.ssl.rest.key-password: rest_keystore_password
    security.ssl.rest.truststore: /opt/flink/ssl/ca.truststore
    security.ssl.rest.truststore-password: ca_keystore_password
    security.ssl.rest.authentication-enabled: false
    security.ssl.verify-hostname: false
When i start sql-client.sh i got this error:
Copy code
2024-02-19 20:53:07,049 DEBUG org.apache.flink.runtime.rest.RestClient                     [] - Rest client endpoint started.
2024-02-19 20:53:07,054 DEBUG org.apache.flink.runtime.rest.RestClient                     [] - Sending request of class class org.apache.flink.runtime.rest.messages.EmptyRequestBody to localhost:39993/v1/api_versions
2024-02-19 20:53:07,255 DEBUG org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBuf [] - -Dorg.apache.flink.shaded.netty4.io.netty.buffer.checkAccessible: true
2024-02-19 20:53:07,256 DEBUG org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBuf [] - -Dorg.apache.flink.shaded.netty4.io.netty.buffer.checkBounds: true
2024-02-19 20:53:07,258 DEBUG org.apache.flink.shaded.netty4.io.netty.util.ResourceLeakDetectorFactory [] - Loaded default ResourceLeakDetector: org.apache.flink.shaded.netty4.io.netty.util.ResourceLeakDetector@25b5c5e3
2024-02-19 20:53:07,849 DEBUG org.apache.flink.shaded.netty4.io.netty.util.Recycler        [] - -Dio.netty.recycler.maxCapacityPerThread: 4096
2024-02-19 20:53:07,853 DEBUG org.apache.flink.shaded.netty4.io.netty.util.Recycler        [] - -Dio.netty.recycler.ratio: 8
2024-02-19 20:53:07,937 DEBUG org.apache.flink.shaded.netty4.io.netty.util.Recycler        [] - -Dio.netty.recycler.chunkSize: 32
2024-02-19 20:53:07,937 DEBUG org.apache.flink.shaded.netty4.io.netty.util.Recycler        [] - -Dio.netty.recycler.blocking: false
2024-02-19 20:53:07,937 DEBUG org.apache.flink.shaded.netty4.io.netty.util.Recycler        [] - -Dio.netty.recycler.batchFastThreadLocalOnly: true
2024-02-19 20:53:08,537 DEBUG org.apache.flink.runtime.rest.RestClient                     [] - Shutting down rest endpoint.
2024-02-19 20:53:08,539 DEBUG org.apache.flink.shaded.netty4.io.netty.buffer.PoolThreadCache [] - Freed 5 thread-local buffer(s) from thread: flink-rest-client-netty-thread-1
2024-02-19 20:53:08,544 INFO  org.apache.flink.table.gateway.rest.SqlGatewayRestEndpoint   [] - Shutting down rest endpoint.
2024-02-19 20:53:08,636 DEBUG org.apache.flink.shaded.netty4.io.netty.buffer.PoolThreadCache [] - Freed 3 thread-local buffer(s) from thread: flink-rest-server-netty-worker-thread-1
2024-02-19 20:53:08,641 INFO  org.apache.flink.table.gateway.rest.SqlGatewayRestEndpoint   [] - Shut down complete.


2024-02-19 20:53:08,644 ERROR org.apache.flink.table.client.SqlClient                      [] - SQL Client must stop.
org.apache.flink.table.client.SqlClientException: Failed to create the executor.
	at org.apache.flink.table.client.gateway.ExecutorImpl.init(ExecutorImpl.java:229) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.gateway.ExecutorImpl.init(ExecutorImpl.java:126) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.gateway.Executor.create(Executor.java:37) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.SqlClient.start(SqlClient.java:110) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.SqlClient.startClient(SqlClient.java:228) [flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.SqlClient.main(SqlClient.java:179) [flink-sql-client-1.18.1.jar:1.18.1]
Caused by: org.apache.flink.table.client.gateway.SqlExecutionException: Failed to get response.
	at org.apache.flink.table.client.gateway.ExecutorImpl.getResponse(ExecutorImpl.java:507) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.gateway.ExecutorImpl.getResponse(ExecutorImpl.java:496) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.gateway.ExecutorImpl.negotiateVersion(ExecutorImpl.java:535) ~[flink-sql-client-1.18.1.jar:1.18.1]
	at org.apache.flink.table.client.gateway.ExecutorImpl.init(ExecutorImpl.java:192) ~[flink-sql-client-1.18.1.jar:1.18.1]
	... 5 more
Caused by: org.apache.flink.shaded.netty4.io.netty.handler.codec.DecoderException: org.apache.flink.shaded.netty4.io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 485454502f312e3120343034204e6f7420466f756e640d0a636f6e74656e742d747970653a206170706c69636174696f6e2f6a736f6e3b20636861727365743d5554462d380d0a6163636573732d636f6e74726f6c2d616c6c6f772d6f726967696e3a202a0d0a636f6e74656e742d6c656e6774683a2033380d0a0d0a7b226572726f7273223a5b224e6f7420666f756e643a202f6261642d72657175657374225d7d
Looking at the response:
Copy code
printf 485454502f312e3120343034204e6f7420466f756e640d0a636f6e74656e742d747970653a206170706c69636174696f6e2f6a736f6e3b20636861727365743d5554462d380d0a6163636573732d636f6e74726f6c2d616c6c6f772d6f726967696e3a202a0d0a636f6e74656e742d6c656e6774683a2033380d0a0d0a7b226572726f7273223a5b224e6f7420666f756e643a202f6261642d72657175657374225d7d | xxd -r -p | xxd

00000000: 4854 5450 2f31 2e31 2034 3034 204e 6f74  HTTP/1.1 404 Not
00000010: 2046 6f75 6e64 0d0a 636f 6e74 656e 742d   Found..content-
00000020: 7479 7065 3a20 6170 706c 6963 6174 696f  type: applicatio
00000030: 6e2f 6a73 6f6e 3b20 6368 6172 7365 743d  n/json; charset=
00000040: 5554 462d 380d 0a61 6363 6573 732d 636f  UTF-8..access-co
00000050: 6e74 726f 6c2d 616c 6c6f 772d 6f72 6967  ntrol-allow-orig
00000060: 696e 3a20 2a0d 0a63 6f6e 7465 6e74 2d6c  in: *..content-l
00000070: 656e 6774 683a 2033 380d 0a0d 0a7b 2265  ength: 38....{"e
00000080: 7272 6f72 7322 3a5b 224e 6f74 2066 6f75  rrors":["Not fou
00000090: 6e64 3a20 2f62 6164 2d72 6571 7565 7374  nd: /bad-request
000000a0: 225d 7d
Can someone provide some insight on this! Without REST SSL the rest replies:
Copy code
DEBUG org.apache.flink.runtime.rest.RestClient                     [] - Received response {"versions":["V1","V2"]}.
Many Thanks.
Flink SQL CLI does not seem to work with rest ssl enabled. ./bin/sql-client.sh -Dsecurity.ssl.rest.enabled=false This is the only way I manage to start sql-client.sh, having all remaing tools using REST SLL
t
The issue you're encountering with the
sql-client.sh
in your SSL-configured Flink deployment on Kubernetes is likely due to the SQL client not properly using HTTPS to communicate with the Flink cluster's REST endpoint. Ensure the SQL client is configured to use HTTPS, the endpoint URL starts with
https://
, and the SQL client trusts the self-signed certificate. Also, check for any compatibility issues with the Flink version and review network configurations in Kubernetes.
r