[00:00.000 --> 00:04.080] All right. Welcome, everyone, to our next talk. I'd like to welcome Barton Rhodes on [00:04.080 --> 00:08.160] securing your Kubeflow clusters. Everybody, please give him a round of applause. [00:12.000 --> 00:20.280] Thank you. So, yeah. I'll talk to you a bit about Kubeflow and Kubernetes and how to get it [00:20.860 --> 00:23.740] set up in a way that is not going to compromise your data. [00:24.420 --> 00:30.660] So, first of all, what is Kubeflow? Kubeflow is a set of open source components that are [00:30.660 --> 00:34.660] running on Kubernetes and are designed for end-to-end deployments of your machine learning [00:34.660 --> 00:42.820] models. So, you may have seen this quote or heard it on a recent podcast. It's a quote by Ian [00:42.820 --> 00:47.100] Coldwater. She said that containers are only as secure as their runtimes and their orchestration [00:47.100 --> 00:50.280] frameworks and their kernels and their operating systems and everything else. [00:50.720 --> 00:56.940] So, this is not a talk about Kubernetes security, per se, or container security, [00:56.940 --> 01:01.480] and we have excellent venues and talks at cons right now where you can go and learn about these [01:01.480 --> 01:08.780] things. What I wanted to do, rather than go into detail on that, is to introduce you to Kubeflow, [01:08.780 --> 01:12.960] let you know that it exists, and help you get started with it in a way that [01:13.780 --> 01:19.260] will give you some secure defaults and will allow you to prevent data exfiltration and [01:20.120 --> 01:24.320] help you to understand a little bit about the security model of Kubeflow and [01:25.600 --> 01:31.180] point you at resources that you can use to learn more about the underlying stack. [01:31.760 --> 01:40.000] So, this may not be new to most of you. I think originally I saw this chart in the paper called [01:40.000 --> 01:43.740] the Hidden Technical Debt Machine Learning. So, the actual machine learning code, the training [01:43.740 --> 01:50.160] code that you use to run your model is only a small portion of most of the things that go into [01:50.160 --> 01:59.240] making a successful deployment of a machine learning project. In many cases, the hard part [01:59.240 --> 02:03.480] begins once you have illustrated the value of the project, once you've shown that it works on your [02:03.480 --> 02:08.380] test data set, and you are asked to integrate it. And this is not a skill set that a lot of [02:08.380 --> 02:12.880] people coming from statistics or data science are equipped with. Obviously, people in this room are [02:14.180 --> 02:18.180] a slightly different mix from a typical data science environment, but that's effectively [02:18.180 --> 02:24.620] the goal of the project is to find open source components, existing cloud native technologies [02:24.620 --> 02:29.740] for every step of the way in deploying the model, starting with data pre-processing in a consistent [02:29.740 --> 02:35.520] manner to training your model to actually tuning your hyperparameters, keeping track of your [02:35.520 --> 02:43.200] experiments and metadata associated with actual model training. So, it's also a nice way of [02:43.760 --> 02:48.880] making data scientists comfortable with a number of Kubernetes concepts. Arguably, [02:48.880 --> 02:54.680] Kubernetes is not the right level of abstraction for a lot of us to understand the data science [02:55.480 --> 03:00.880] people and analysts understand the infrastructure that we consume. [03:01.180 --> 03:06.520] Typically, we just want to have compute. We want to be able to run our models within a certain [03:06.520 --> 03:10.280] amount of time. We want to be able to migrate our workloads between different deployment [03:10.720 --> 03:17.640] environments. And we want to do it in a manner that's familiar to us and using the tools that are [03:18.320 --> 03:23.360] commonly used by us every day. And so, that's the why of it. So, [03:23.360 --> 03:27.400] Kubeflow, like I said, reuses open source components. And it is designed to [03:28.880 --> 03:35.920] give you a sane defaults and integration pieces for every likely aspect of what you use. And so, [03:35.920 --> 03:41.860] here's an example of one of the possible deployment scenarios where, as a data scientist, [03:41.860 --> 03:46.960] you may start in Jupyter Notebook, which is a natural environment for a lot of data scientists, [03:46.960 --> 03:54.840] and then have the same workload that you run for training and prediction in the cloud. And [03:55.520 --> 04:01.120] including a managed service like AI Platform and run it on premise and basically anywhere [04:01.120 --> 04:07.900] Kubernetes runs. So, that's the goal. In order to accomplish this goal, [04:07.900 --> 04:13.860] it's a very young project. And so, my background coming into it is I am deploying this in a [04:13.860 --> 04:21.220] healthcare setting where you may have considerations of cost, considerations of data locality. [04:21.220 --> 04:27.540] You need to have sort of building blocks that are stackable by data scientists. And so, [04:27.540 --> 04:31.640] these building blocks is a project, subproject of Kubeflow called Faring. [04:32.520 --> 04:40.320] So, to introduce you to this, I would like to sort of point you to a series of blog posts by [04:40.320 --> 04:44.980] Netflix. And sort of it's trying to bring the Netflix model of notebook deployments to [04:45.620 --> 04:52.200] an open source project where a lot of not just data exploration, but, you know, [04:52.200 --> 04:56.780] model training or model inferencing happens inside of notebook. But also, [04:56.780 --> 05:01.620] the data engineering tasks and tasks that are repeatable. And there's lyrical paper mill that [05:01.620 --> 05:10.880] Faring integrates. So, Faring allows you to ask a question. How much of the actual workflow can [05:10.880 --> 05:15.580] we make reproducible directly from the Jupyter notebook? And so, this may sound crazy, but if [05:15.580 --> 05:21.420] you think about, you know, typical workloads that you encounter in large projects, the actual [05:21.420 --> 05:26.480] execution of your IPython kernel and things like that is a minor part of that. So, computationally, [05:26.480 --> 05:32.040] that's not a hard constraint. And Faring is a project that allows you to do that. [05:32.040 --> 05:36.340] So, to illustrate the benefits of Faring SDK, which is a Python SDK, [05:38.140 --> 05:43.960] you can see the current approach to deployments that are local. So, you may work in your [05:43.960 --> 05:48.360] preferred environment, not necessarily notebook. You know, Faring is equally usable from your [05:48.360 --> 05:56.280] favorite ID. You then would have to adapt it to some deployment surface, like it's a platform or [05:58.520 --> 06:04.500] actual managed service of some kind or your own API endpoint that you build. And then [06:05.340 --> 06:12.100] the way to deploy it in Kubeflow right now is through consuming the TF job type deployments. [06:12.100 --> 06:17.300] And so, that's a lot of modification and refactoring in every step where your target [06:17.300 --> 06:22.760] deployment and your local deployment differ introduces potential for bugs to creep in. [06:22.900 --> 06:31.720] So, with Faring, you can have a fairly simple way of migrating your workloads by abstracting away [06:31.720 --> 06:35.620] the backend and the deployment procedure for your model. So, that's one of the ways that [06:35.620 --> 06:43.320] Kubeflow allows you to benefit from coderies. And you can transition the environments [06:44.080 --> 06:48.840] pretty seamlessly by just swapping out whichever Kubeflow config that you have. So, you could [06:48.840 --> 06:55.440] target the cluster that's isolated. Healthcare cluster that has spatial data, you can target [06:55.440 --> 07:04.480] GKE. And so, pretty much any scenario where you would have Kubernetes can be easily addressed, [07:04.480 --> 07:08.860] including local environments. So, if you're used to developing locally with a minikube, [07:08.860 --> 07:12.120] if you're exposed to that, you don't have to change a lot of the templates that [07:13.960 --> 07:17.100] you work with in the cloud to be able to execute it. [07:18.240 --> 07:23.380] So, here's where it gets into security. So, like, all of these niceties are nice to have. But, [07:23.380 --> 07:29.040] you know, it's very, very important that we understand the security model and different [07:29.040 --> 07:34.200] permissions and exposure that you get by using these services. So, once again, my goal is to [07:34.200 --> 07:43.120] inform you as to where we are today and give you an idea as to what is affected by permissions [07:43.120 --> 07:48.080] that you have and sort of put it in front of you and let you examine it and, you know, [07:48.080 --> 07:54.300] understand the different approaches. So, as a part of the Jupyter Notebook service that comes [07:54.300 --> 07:59.400] into Kubeflow, you get access to a variety of resources. So, you can schedule pods, [07:59.400 --> 08:05.080] create deployment services, including training jobs and inference jobs in PyTorch, TensorFlow, [08:05.080 --> 08:11.440] and other frameworks are being added all the time. So, you can create this directly from [08:11.440 --> 08:20.060] your notebook. And you can once again have that as a repeatable step in your MLOps workload. [08:20.620 --> 08:26.680] That's the blog post that actually goes into it. So, the end result of this is to be able to, [08:26.680 --> 08:30.400] instead of making every deployment a one-off deployment where, you know, [08:30.400 --> 08:38.080] majority of data science projects actually end up not realizing their investment, you want to be [08:38.080 --> 08:44.680] able to have something that's automated and repeatable. So, that's the Netflix model that [08:44.680 --> 08:55.120] fairing enables. So, you can find the fairing SDK on GitHub. And the scenarios in which you use it [08:55.120 --> 09:01.580] is through consumption by the notebook and some sort of environment where you can use Python. So, [09:01.580 --> 09:10.020] you can imagine an airflow trigger. It can be any variety of different scenarios where [09:10.560 --> 09:15.660] the workflow needs to be automated. However, you get to a point where, you know, you want to be [09:15.660 --> 09:23.020] able to have a more defined workflow. Let's say you have deployed it. You've exposed your endpoint. [09:23.020 --> 09:28.540] So, typically, the end result of the fairing workflow is some sort of an endpoint where you [09:28.540 --> 09:36.200] have the ability to pass it on to your UI team, for instance, to build a simple UI around it. [09:36.420 --> 09:42.600] Or you have some other downstream service consuming it. So, that's as far as fairing [09:42.600 --> 09:45.980] gets you. And you can get that from the notebook or from a repeatable process. But what if you [09:45.980 --> 09:53.360] have a complex end-to-end process that requires a lot of many different steps that fail and you [09:53.360 --> 09:59.840] want to isolate each of those steps and control the security permission model on each individual [09:59.840 --> 10:05.040] part of the DAG. So, that's where Kubeflow Pipelines comes in. So, Pipelines is a different [10:05.040 --> 10:09.640] component I wanted to introduce you to before we jump into what you can do to make these deployments [10:09.640 --> 10:18.620] secure. It's a UI for managing experiments, jobs, and runs. So, it's also an SDK that effectively [10:18.620 --> 10:25.040] allows you to break down your entire end-to-end workflow into a number of containerized operations. [10:25.820 --> 10:31.420] So, instead of thinking in terms of an entire function that does a number of different things, [10:31.420 --> 10:38.060] from data preprocessing to outlier removal to training and then tuning, you can imagine [10:38.060 --> 10:44.520] your scenario. You isolate each component of that workflow into its own component. And [10:44.520 --> 10:50.240] you have the Docker image or something that captures the requirements of your model [10:51.140 --> 10:59.100] in one place. And you then can add things like monitoring to it. And all you have to do is to [10:59.100 --> 11:03.100] follow a number of standard interfaces that are defined in the container ops spec. [11:03.540 --> 11:08.800] So, the benefit of that is to be able to not only [11:12.040 --> 11:18.580] get performance out of your models by addressing bottlenecks, but you can also freeze a version [11:18.580 --> 11:25.080] of your model in time by looking at the exact image that was used to run at any given step [11:25.080 --> 11:30.720] of the model. So, if your goal is reproducibility, which I think it should be, you can get back to [11:30.720 --> 11:35.100] exact versions of containers that were used to run your model. So, [11:38.640 --> 11:43.120] visualization of the DAG might look like this. So, that's an example of the XGBoost run that [11:43.120 --> 11:50.340] you can find in the docs. So, as you can see, the operations here are not limited to just the [11:50.340 --> 11:54.500] ML tasks, like, you know, training and transformation of the data. But things [11:54.500 --> 12:01.640] like creating clusters. And if you go a few slides back, we can find that we have access [12:01.640 --> 12:08.480] to pods, deployment services, and jobs. So, you can not only do the modeling, but everything [12:08.480 --> 12:13.640] required for it in terms of infrastructure and service requirements that are needed. And then [12:14.240 --> 12:19.580] introduce monitoring and outputs in intermediate steps. So, one of the things you could do is [12:19.580 --> 12:25.540] visualize the HTML output of the Jupyter notebook that gives you some reference metrics for how [12:25.540 --> 12:30.640] well your model is doing. Or visualize a confusion matrix or an ROC curve. Something that will give [12:30.640 --> 12:36.520] you a way of visually debugging it. Which is one more place where the notebooks sort of make an [12:36.520 --> 12:41.820] appearance. You can take the same fairy notebooks that you use for analysis and integrate them into [12:41.820 --> 12:48.940] these intermediate steps as a form of, like, debugging intermediate steps. This is a diagram [12:48.940 --> 12:56.180] of what happens behind the scenes as far as allowing it to happen. So, if you actually look [12:56.180 --> 13:00.860] at the way pipelines are implemented, they're Argo workflows with a very thin sort of layer [13:00.860 --> 13:05.420] that makes it adaptable to Kubeflow pipelines. But if you are familiar with Argo, everything [13:05.420 --> 13:13.800] that Argo normally gets you, which is event driven workloads, isolation of individual steps, [13:13.800 --> 13:21.800] and you get with it. And so, in the recent version, you actually have the metadata store. So, [13:21.800 --> 13:28.260] every run of a Kubeflow pipeline is versioned. And the information about it is stored into a [13:28.260 --> 13:34.980] metadata database, which is a MySQL database with a JSON schema that allows you to track [13:34.980 --> 13:38.900] artifacts. The artifacts are pipelines or individual container operations in the pipeline. [13:39.620 --> 13:46.220] Once again, it's a lot of opportunity to mess up and expose some part of the [13:47.280 --> 13:54.140] architecture to the outside world. So, it's imperative that we talk more about how we [13:54.660 --> 14:05.640] isolate that. And as you can see, the entire architecture is quite complex. So, [14:05.640 --> 14:10.440] this talks a little bit about the domain specific language that Kubeflow pipelines gives you. So, [14:10.440 --> 14:15.140] you have container ops, pipeline parameters, components. There are a number of standard [14:15.140 --> 14:21.420] components that come with prebuilt containers and images that allow you to run simple Python [14:21.420 --> 14:28.000] functions that don't require a lot of dependencies. There are operations that allow you to handle [14:28.000 --> 14:33.800] volumes. So, you can actually create a data store that's needed for your storage of intermediate [14:33.800 --> 14:38.800] artifacts, like weights on your model or some debugging outputs. And [14:41.840 --> 14:45.260] this is an example of a specification, like a lot of things in Granny's world, [14:45.260 --> 14:50.540] you define it using YAML. So, as long as you are consistent in what inputs, outputs [14:52.080 --> 14:57.200] each individual step takes. So, you can attach an image to it and you can actually run a train [14:57.200 --> 15:03.540] command that or any other sort of entry point that will take arguments and allow you to [15:03.800 --> 15:11.040] execute a specific workload in a specific manner with a number of arguments that will power it. [15:11.180 --> 15:19.800] What does it get us? Take a step back from the concrete detail over there. It gets us a standard [15:19.800 --> 15:27.340] reusable component structure that allows us to take our work and be able to take it with us or [15:28.380 --> 15:34.840] generalize it to problems that we might encounter down the line. So, instead of learning a specific [15:34.840 --> 15:43.300] stack at one of the big four, we can actually go ahead and build in a manner that is shareable and [15:43.300 --> 15:52.440] is available to be executed anywhere. So, as a Google project, it initially had more contributors [15:52.440 --> 15:57.300] from Google. It recently passed the point where a majority of contributors actually come from the [15:57.300 --> 16:02.820] community. David Aronchik, the person who started as a PM of the project with Google, is now at [16:02.820 --> 16:10.360] Microsoft and bringing it to Azure. So, it's got broad support by the community and it's a [16:10.360 --> 16:15.800] community-driven project. In the future, you can imagine individual pieces of your pipelines [16:15.800 --> 16:26.040] becoming shared with others in a reusable manner. So, that's it about Kubeflow. I just wanted to [16:26.040 --> 16:29.640] give you a brief introduction. There's a lot more to it. And that's just scratching the surface by [16:29.640 --> 16:34.560] looking at these two components that get you from notebook interface to something that's [16:34.560 --> 16:41.420] event-driven and triggerable and reusable. So, I want to talk about benefits of this approach and [16:41.420 --> 16:48.100] how we think about security in Kubeflow. So, principle of least privilege, I think, is a [16:48.100 --> 16:53.160] benefit not just for this project, but Kubernetes in general. And then it's a good argument for [16:53.160 --> 16:59.080] running things in containers in the first place instead of having one service account with access [16:59.080 --> 17:04.680] to everything in your infrastructure. You can isolate your workloads by specific tasks that [17:04.680 --> 17:10.200] they're needed to perform. So, in this case, you can think about a container operation that [17:10.200 --> 17:16.500] needs to read data from a Google Cloud Storage bucket. The service accounts, the secrets that [17:16.500 --> 17:23.500] you expose to that container do not need to have anything beyond that. And if there is a [17:23.500 --> 17:29.660] vulnerability in some component of that container or if the container gets compromised, you don't [17:29.660 --> 17:34.520] lose access to the entire infrastructure. So, once again, to inform you what is happening now. And [17:34.520 --> 17:41.640] for context, a lot of this is still not like GA or it's not 1.0 version. So, the latest stable [17:41.640 --> 17:50.100] version is 0.6. Security tends to take a backseat when rapid development is a goal. And so, right [17:50.100 --> 17:56.560] now is the time to start thinking about how can we improve this? And so, my goal is to, by informing [17:56.560 --> 18:02.280] you, let you get to the GitHub, play with the code, see what you can do, see how you can break [18:02.280 --> 18:10.100] and hopefully open some issues and pull requests to help us do better. So, from that perspective, [18:10.100 --> 18:16.420] I will introduce you to the three service accounts and permissions that are currently deployed with [18:16.420 --> 18:23.060] them. So, we have... and a lot of this maps into the on-premise deployment, but of necessity, [18:23.840 --> 18:28.020] Google Cloud Platform has been more of a stable target for Kubeflow as of now. So, if you're [18:28.020 --> 18:34.100] dealing in the on-premise environment, I think things like IAM roles I'll be describing now, [18:34.100 --> 18:40.340] they're more specific to Google Cloud Platform and won't translate as easily to your on-premise [18:40.340 --> 18:48.000] role-based authentication. So, one service account is admin and it's used to actually deploy and [18:48.000 --> 18:57.620] configure the cluster. So, you can find the KFCTL script that is going to use the admin [18:57.620 --> 19:03.320] service account to perform most of the deployments. User is what most data scientists will encounter [19:04.400 --> 19:09.660] in their day-to-day. So, that allows you to use and consume GCP resources and interact with [19:09.660 --> 19:15.200] GCP resources from your container operations or fairing if you're using a Jupyter notebook. [19:15.360 --> 19:22.760] And we have the logging account as well, which uses VM, which is called VM and it's used to [19:22.760 --> 19:30.980] take audit logs and send them to Stackdriver. So, as far as concrete roles for the account, [19:30.980 --> 19:34.920] and all of these can be adjusted, by the way. So, this is taken directly from a Cloud Deployment [19:34.920 --> 19:40.160] Manager template that you can find in the repository. The admin service account has [19:40.160 --> 19:45.240] source admin, which is allowing you to push the application to Cloud Repository. [19:45.740 --> 19:50.580] It has the management account, which allows you to control the endpoints and the host names of [19:50.580 --> 19:58.440] those endpoints. Network admin is used to enable identity-aware proxy, which allows you to use your [19:58.440 --> 20:04.560] Google account to authenticate against different resources and consume them, as well as health [20:04.560 --> 20:09.860] checks. So, that's the admin account. If you wanted to change these, you would add things to [20:09.860 --> 20:14.180] the template, but that would be specific to your organization's security policy. [20:14.860 --> 20:25.460] The user service account allows you to do things like build custom things in Container Builder. [20:25.460 --> 20:31.820] That's important if you want to run your application in the context where you don't have [20:31.820 --> 20:38.340] access to GCR, Google Container Registry. And so, the builder allows you to actually package it up [20:38.340 --> 20:46.280] as a coherent sort of end-to-end application and deploy it potentially in an air-gapped environment, [20:46.280 --> 20:51.880] which could be a concern for security. You can have a viewer role for actually [20:51.880 --> 20:57.340] viewing the resources of the builds. And then, this is just an example. Your services may vary. [20:57.340 --> 21:01.360] So, for instance, you want to add Dataproc or something. This is not currently captured here, [21:01.360 --> 21:06.560] but this is a minimal set of permissions for interacting with Cloud Storage buckets, BigQuery, [21:06.560 --> 21:15.280] Dataflow, all of which will probably help you with data. And then, of course, the monitoring [21:15.280 --> 21:20.840] account, Log Writer, Metric Writer, and Object Viewer. So, these are the roles that you can [21:20.840 --> 21:25.300] review and decide whether they're appropriate or not. One of the things that hasn't been mentioned [21:25.300 --> 21:31.980] in the earlier slide is an IAP account. So, this actually goes to your user account that [21:31.980 --> 21:36.700] authenticates against Identity-Aware Proxy. So, you have to be able to have an Object Viewer [21:37.460 --> 21:44.640] role on that as a part of the implementation. And then, VM Service Account, like I said, [21:44.640 --> 21:53.980] has Log Writer and all that. So, okay. So, that's based on Kubeflow's built-in roles right now. [21:55.440 --> 22:01.360] The way that it relates to role-based authentication in Kubernetes is it [22:01.360 --> 22:08.660] complements it. So, when you are trying to define that, IAM can only get you so far. And it's [22:08.660 --> 22:16.540] probably better for metadata and access to other objects that are accessible through IAM and [22:16.540 --> 22:20.320] controlled through IAM roles. If you wanted to actually interact with Kubernetes permissions [22:20.320 --> 22:24.480] themselves, you could create other objects like cluster roles and cluster bindings that [22:25.760 --> 22:31.700] will help you control the management of your resources using the Kubernetes model. So, [22:31.700 --> 22:37.460] once again, I point you to resources towards the end where this can be addressed in more detail. [22:39.500 --> 22:50.140] So, this is a brief description of how that works. And just to clarify, one thing is that [22:50.320 --> 22:57.860] at point six, we now have per user namespace isolation. So, if you start with a new project [22:57.860 --> 23:02.260] and you add your own user, all of your pods, notebook services, endpoints that you deploy [23:02.260 --> 23:06.480] will be contained to that namespace. And so, other data scientists or other teams [23:07.920 --> 23:13.900] may not necessarily have access to your namespace. That buys you multi-tenancy and things like that. [23:13.900 --> 23:19.160] So, it's important to, for instance, if you are in a context where certain projects require a [23:19.160 --> 23:24.940] separate set of NDAs or have some PII that should not be accessible outside of your particular [23:24.940 --> 23:33.800] analysis. Okay. So, the gist of this talk is actually quite simple. There are two main things [23:33.800 --> 23:38.400] you can do as a data scientist when deploying this. My goal is for you to go back to your [23:38.400 --> 23:45.900] place of employment and try this. And when you try it, I don't want you to add cryptocurrency [23:45.900 --> 23:52.780] miners to your company's infrastructure. So, a few simple precautions can help you avoid that. [23:52.780 --> 23:59.880] So, the main one, honestly, is the VPC service control idea. So, what that allows you to do [23:59.880 --> 24:06.740] is to restrict access to certain API endpoints that will be consumed by your application to only [24:06.740 --> 24:14.620] the services and pods that come from within your Kubeflow deployment. VPC service control model. [24:16.900 --> 24:24.280] Gives you the secure perimeter within which only the clients that are authorized can have [24:24.280 --> 24:29.540] private access to resources, create them, copy them. And so, to be clear, this only applies to [24:29.540 --> 24:33.540] the content within those resources, not the metadata about those resources. If you wanted [24:33.540 --> 24:37.540] to manage the metadata, you would have to fall back on the IAM models. So, if you're trying to [24:38.320 --> 24:44.960] copy things from Google Cloud Storage or do things in BigQuery, if you want to make sure that [24:45.900 --> 24:52.980] your team in a different geographic locale will not have the same access, you just use VPC service [24:52.980 --> 25:00.580] controls to isolate them. So, these are some of the benefits that allow you to... that I could [25:00.580 --> 25:10.400] go into more detail on if there are any questions. But effectively, it's configurable using standard [25:10.400 --> 25:18.180] credentials. You have ability to restrict it by service. And here's an example of how you would [25:18.180 --> 25:23.280] do that. Of course, all of these environment variables actually have to be set. But this is [25:23.280 --> 25:31.960] the command line approach in which case you enable the resource manager API and the other prerequisite [25:31.960 --> 25:38.080] steps. There are similar ways of defining a secure perimeter in the UI in GCP. Once again, [25:38.080 --> 25:41.960] this would be different on your actual on-premise deployment. But you could say that [25:43.400 --> 25:48.300] your application should only be able to access PubSub or Storage API and should not be able to [25:48.300 --> 25:52.980] access Bigtable or other services within the perimeter. And you can restrict it to specific [25:52.980 --> 25:58.980] projects which in GCP land have come with their own set of isolations. So, when you're setting it [25:58.980 --> 26:04.460] up and trying to justify it to your boss, just make sure to say that you will not have issues [26:04.460 --> 26:09.780] with some high security service. Let's say BigQuery has all of your critical data. [26:10.920 --> 26:15.300] Another thing you can do, and I recommend doing this especially if you're exposing [26:16.200 --> 26:24.140] any resources that have a load balancer in front of them, restrict it by authorized networks by [26:24.140 --> 26:28.380] using a specific IP range that you'll be heading them from. So, it's something that [26:29.460 --> 26:37.400] can save you from unfortunate outcomes. Here's another command line example of what you saw [26:37.400 --> 26:42.120] earlier in the UI. So, in this case, you once again define a secure perimeter. But that's [26:42.120 --> 26:47.020] something that you can automate for creation of new projects either with Cloud Deployment [26:47.020 --> 26:54.320] Manager Terraform or other tool like that. Don't make it a guesswork every time. And try to [26:54.320 --> 26:59.040] you know, fall back on good practices and discuss with your team and understand like what is within [26:59.040 --> 27:07.080] your security budget. So, effectively, we have different APIs here. In this case, [27:07.080 --> 27:12.920] we're enabling BigQuery container registry and storage. But you know, your use case may vary. [27:12.920 --> 27:19.920] And so, I added some diagrams in case you wanted to see practically what this gives you. So, [27:19.920 --> 27:24.640] once you have a certain service perimeter that allows within which you run Kubeflow, [27:25.180 --> 27:30.180] you will not have to worry about unauthorized access from outside world or other clients that [27:30.180 --> 27:35.820] will consume it in ways that you didn't intend. This is the case for cloud. The on-premise [27:35.820 --> 27:40.520] situation a little bit more complicated, especially with GKE on-prem and Anthos. [27:41.400 --> 27:48.160] You know, you can have these things a bit more configured. But once again, this has been mostly [27:48.160 --> 27:54.920] GCP focused. In this case, you can extend your VPC perimeter into a on-premise network by using [27:54.920 --> 28:02.500] some sort of a VPN gateway that could come with its own subnet. And by defining strict firewall [28:02.500 --> 28:08.740] rules for how different VPCs talk to each other, you can prevent that from happening. Honestly, [28:09.860 --> 28:12.220] if you get to this point, you should probably work with your [28:13.840 --> 28:19.700] own operations as DLC teams. But as a one-off experiment, I recommend just [28:19.700 --> 28:25.540] running on GCP and configuring very basic service perimeter like so. [28:26.600 --> 28:32.540] One last step. I think it may seem obvious, but one of the most common ways GCP accounts [28:32.540 --> 28:39.660] get compromised is service account leakage. It's either somebody commits to GitHub or, [28:39.660 --> 28:44.440] like, that can happen. Especially for newer data analysts, data scientists, [28:44.500 --> 28:48.780] a lot of the tutorials advise you to add everything in your directory to get committed. [28:48.780 --> 28:53.060] So that's how a lot of that stuff happens. It's a true story. [28:54.060 --> 28:57.940] Luckily, Kubernetes allows you to store credentials in a secure manner that can be [28:57.940 --> 29:03.180] accessed from a variety of places in Kubeflow infrastructure. And I wanted to show you how to [29:03.180 --> 29:08.980] go through that really briefly. So you can add a secret by using standard secret creation interface. [29:08.980 --> 29:14.660] Secret can be a service account, JSON, environment variable that you set. I recommend using secrets [29:14.660 --> 29:19.500] for anything JSON or even the passwords that you want to consume later. [29:20.480 --> 29:25.540] You can spread the credentials to your entire infrastructure by using Google application [29:25.540 --> 29:30.440] credentials, which is your environment variable that stores your service account files and that [29:30.440 --> 29:35.780] every pod that will start with a certain service account within your cluster will have access to [29:35.780 --> 29:43.460] those resources. Let's say there is something every pod has to hit. Once again, per namespace, [29:43.460 --> 29:47.860] so you don't have to worry about leaking to your colleagues. You can authenticate from the pod [29:47.860 --> 29:55.040] directly by picking it up from a secret store and mounting a GCP secret as a volume. Once again, [29:55.040 --> 30:02.360] this environment variable is how your SDK will know what to authenticate with. You can access [30:02.360 --> 30:06.820] secrets from a pipeline. So if you remember the components earlier, it's part of the DSL to be [30:06.820 --> 30:16.160] able to include a specific secret into your pipeline. So think of this as a critical step. [30:16.160 --> 30:20.460] So it may be very tempting to add your secret to your Docker image if you're on a deadline, [30:20.460 --> 30:26.540] but if you just follow these simple procedures and you add secrets by using the DSL directly, [30:26.540 --> 30:35.200] you're preventing unnecessary harm from leaking your service accounts to your registry. [30:36.220 --> 30:40.900] Lastly, I had a little bit of material on the .6 edition, which just happened. [30:40.900 --> 30:45.800] What migration from .5 was the replacement of Ambassador Proxy with the Istio gateway. And [30:46.660 --> 30:51.340] at this point, it may not be as relevant to a day-to-day use by data scientists, but [30:51.340 --> 30:57.980] Istio comes with a number of very nice ways of controlling flow of data and security between [30:57.980 --> 31:05.240] different services in your cluster. And so you get a lot of things for free, like AuthC, [31:05.240 --> 31:13.260] authentication, authorization, and things like fault injections, which allow you to test [31:13.260 --> 31:20.480] your model. And so I'll wrap up real quick, but I wanted to point you to some resources and [31:20.480 --> 31:25.640] references. So Kubeflow.org is great. There are private clusters, description over there. [31:25.640 --> 31:30.940] And a lot of this material came from Kubeflow documentation, and as well as the blog post [31:30.940 --> 31:36.200] by Arikto, which did a really good write-up on authentication. Please join our Slack, [31:36.200 --> 31:40.600] start contributing. We need security people to look at this before it hits 1.0 so that we don't [31:40.600 --> 31:45.620] have nasty surprises down the line. And thank you. You can find me on Twitter, Keybase, GitHub, [31:45.620 --> 31:47.620] or feel free to email me directly.