I should be in the format of k8s://https://<k8s-apiserver-host>:<k8s-apiserver-port>
In your case use it in the following way:
val spark = SparkSession.builder().appName("Demo").master(k8s://https://<k8s-apiserver-host>:<k8s-apiserver-port>).getOrCreate()