1 00:00:00,000 --> 00:00:00,520 All right. 2 00:00:00,520 --> 00:00:02,460 Welcome, everyone, to our next talk. 3 00:00:02,460 --> 00:00:05,900 I'd like to welcome Barton Rhodes on securing your Kubeflow clusters. 4 00:00:05,900 --> 00:00:08,160 Everybody, please give him a round of applause. 5 00:00:12,000 --> 00:00:12,900 Thank you. 6 00:00:14,100 --> 00:00:14,760 So, yeah. 7 00:00:14,760 --> 00:00:23,740 I'll talk to you a bit about Kubeflow and Kubernetes and how to get it set up in a way that is not going to compromise your data. 8 00:00:24,420 --> 00:00:26,540 So, first of all, what is Kubeflow? 9 00:00:26,880 --> 00:00:35,400 Kubeflow is a set of open source components that are running on Kubernetes and are designed for end-to-end deployments of your machine learning models. 10 00:00:35,400 --> 00:00:41,720 So, you may have seen this quote or heard it on a recent podcast. 11 00:00:41,900 --> 00:00:43,700 It's a quote by Ian Coldwater. 12 00:00:43,800 --> 00:00:50,280 She said that containers are only as secure as their runtimes and their orchestration frameworks and their kernels and their operating systems and everything else. 13 00:00:50,720 --> 00:01:02,260 So, this is not a talk about Kubernetes security, per se, or container security, and we have excellent venues and talks at cons right now where you can go and learn about these things. 14 00:01:02,640 --> 00:01:31,180 What I wanted to do, rather than go into detail on that, is to introduce you to Kubeflow, let you know that it exists, and help you get started with it in a way that will give you some secure defaults and will allow you to prevent data exfiltration and help you to understand a little bit about the security model of Kubeflow and point you at resources that you can use to learn more about the underlying stack. 15 00:01:31,760 --> 00:01:35,660 So , this may not be new to most of you. 16 00:01:35,660 --> 00:01:41,740 I think originally I saw this chart in the paper called the Hidden Technical Debt Machine Learning. 17 00:01:41,740 --> 00:01:53,900 So, the actual machine learning code, the training code that you use to run your model is only a small portion of most of the things that go into making a successful deployment of a machine learning project. 18 00:01:55,320 --> 00:02:05,860 In many cases, the hard part begins once you have illustrated the value of the project, once you've shown that it works on your test data set, and you are asked to integrate it. 19 00:02:05,860 --> 00:02:11,460 And this is not a skill set that a lot of people coming from statistics or data science are equipped with. 20 00:02:11,460 --> 00:02:27,780 Obviously, people in this room are a slightly different mix from a typical data science environment, but that's effectively the goal of the project is to find open source components, existing cloud native technologies for every step of the way in deploying the model, 21 00:02:27,780 --> 00:02:39,180 starting with data pre-processing in a consistent manner to training your model to actually tuning your hyperparameters, keeping track of your experiments and metadata associated with actual model training. 22 00:02:39,340 --> 00:02:47,340 So, it's also a nice way of making data scientists comfortable with a number of Kubernetes concepts. 23 00:02:47,340 --> 00:03:00,880 Arguably, Kubernetes is not the right level of abstraction for a lot of us to understand the data science people and analysts understand the infrastructure that we consume. 24 00:03:01,180 --> 00:03:02,880 Typically, we just want to have compute. 25 00:03:02,880 --> 00:03:07,120 We want to be able to run our models within a certain amount of time. 26 00:03:07,120 --> 00:03:11,560 We want to be able to migrate our workloads between different deployment environments. 27 00:03:11,740 --> 00:03:20,000 And we want to do it in a manner that's familiar to us and using the tools that are commonly used by us every day. 28 00:03:20,300 --> 00:03:22,160 And so, that's the why of it. 29 00:03:22,940 --> 00:03:26,260 So, Kubeflow, like I said, reuses open source components. 30 00:03:26,260 --> 00:03:35,640 And it is designed to give you a sane defaults and integration pieces for every likely aspect of what you use. 31 00:03:35,640 --> 00:03:54,400 And so, here's an example of one of the possible deployment scenarios where, as a data scientist, you may start in Jupyter Notebook, which is a natural environment for a lot of data scientists, and then have the same workload that you run for training and prediction in the cloud. 32 00:03:54,400 --> 00:04:02,120 And including a managed service like AI Platform and run it on premise and basically anywhere Kubernetes runs. 33 00:04:02,120 --> 00:04:03,720 So, that's the goal. 34 00:04:05,340 --> 00:04:09,280 In order to accomplish this goal, it's a very young project. 35 00:04:09,280 --> 00:04:19,800 And so, my background coming into it is I am deploying this in a healthcare setting where you may have considerations of cost, considerations of data locality. 36 00:04:20,660 --> 00:04:27,360 You need to have sort of building blocks that are stackable by data scientists. 37 00:04:27,360 --> 00:04:31,640 And so, these building blocks is a project, subproject of Kubeflow called Faring. 38 00:04:32,520 --> 00:04:40,920 So, to introduce you to this, I would like to sort of point you to a series of blog posts by Netflix. 39 00:04:40,920 --> 00:04:56,440 And sort of it's trying to bring the Netflix model of notebook deployments to an open source project where a lot of not just data exploration, but, you know, model training or model inferencing happens inside of notebook. 40 00:04:56,440 --> 00:04:59,900 But also, the data engineering tasks and tasks that are repeatable. 41 00:05:00,040 --> 00:05:03,160 And there's lyrical paper mill that Faring integrates. 42 00:05:03,160 --> 00:05:06,480 So, Faring allows you to ask a question. 43 00:05:06,480 --> 00:05:13,840 How much of the actual workflow can we make reproducible directly from the Jupyter notebook? 44 00:05:13,840 --> 00:05:25,520 And so, this may sound crazy, but if you think about, you know, typical workloads that you encounter in large projects, the actual execution of your IPython kernel and things like that is a minor part of that. 45 00:05:25,520 --> 00:05:29,380 So, computationally, that's not a hard constraint. 46 00:05:29,380 --> 00:05:32,040 And Faring is a project that allows you to do that. 47 00:05:32,040 --> 00:05:42,840 So, to illustrate the benefits of Faring SDK, which is a Python SDK, you can see the current approach to deployments that are local. 48 00:05:42,840 --> 00:05:46,200 So, you may work in your preferred environment, not necessarily notebook. 49 00:05:46,200 --> 00:05:49,900 You know, Faring is equally usable from your favorite ID. 50 00:05:50,940 --> 00:06:04,080 You then would have to adapt it to some deployment surface, like it's a platform or actual managed service of some kind or your own API endpoint that you build. 51 00:06:04,080 --> 00:06:12,100 And then the way to deploy it in Kubeflow right now is through consuming the TF job type deployments. 52 00:06:12,100 --> 00:06:22,760 And so, that's a lot of modification and refactoring in every step where your target deployment and your local deployment differ introduces potential for bugs to creep in. 53 00:06:22,900 --> 00:06:34,080 So, with Faring, you can have a fairly simple way of migrating your workloads by abstracting away the backend and the deployment procedure for your model. 54 00:06:34,080 --> 00:06:40,600 So, that's one of the ways that Kubeflow allows you to benefit from coderies. 55 00:06:40,600 --> 00:06:48,360 And you can transition the environments pretty seamlessly by just swapping out whichever Kubeflow config that you have. 56 00:06:48,360 --> 00:06:51,560 So, you could target the cluster that's isolated. 57 00:06:52,200 --> 00:06:56,000 Healthcare cluster that has spatial data, you can target GKE. 58 00:06:56,000 --> 00:07:05,980 And so, pretty much any scenario where you would have Kubernetes can be easily addressed, including local environments. 59 00:07:05,980 --> 00:07:17,100 So, if you're used to developing locally with a minikube, if you're exposed to that, you don't have to change a lot of the templates that you work with in the cloud to be able to execute it. 60 00:07:18,240 --> 00:07:20,640 So, here's where it gets into security. 61 00:07:20,640 --> 00:07:23,200 So, like, all of these niceties are nice to have. 62 00:07:23,200 --> 00:07:32,900 But, you know, it's very, very important that we understand the security model and different permissions and exposure that you get by using these services. 63 00:07:32,900 --> 00:07:50,440 So, once again, my goal is to inform you as to where we are today and give you an idea as to what is affected by permissions that you have and sort of put it in front of you and let you examine it and, you know, understand the different approaches. 64 00:07:50,440 --> 00:07:57,720 So, as a part of the Jupyter Notebook service that comes into Kubeflow, you get access to a variety of resources. 65 00:07:57,760 --> 00:08:08,100 So, you can schedule pods, create deployment services, including training jobs and inference jobs in PyTorch, TensorFlow, and other frameworks are being added all the time. 66 00:08:08,100 --> 00:08:12,360 So, you can create this directly from your notebook. 67 00:08:12,360 --> 00:08:20,060 And you can once again have that as a repeatable step in your MLOps workload. 68 00:08:20,620 --> 00:08:23,460 That's the blog post that actually goes into it. 69 00:08:23,460 --> 00:08:43,080 So, the end result of this is to be able to, instead of making every deployment a one-off deployment where, you know, majority of data science projects actually end up not realizing their investment, you want to be able to have something that's automated and repeatable. 70 00:08:43,080 --> 00:08:45,800 So, that's the Netflix model that fairing enables. 71 00:08:46,360 --> 00:08:51,400 So, you can find the fairing SDK on GitHub. 72 00:08:51,680 --> 00:09:01,460 And the scenarios in which you use it is through consumption by the notebook and some sort of environment where you can use Python. 73 00:09:01,460 --> 00:09:07,300 So, you can imagine an airflow trigger. 74 00:09:07,300 --> 00:09:12,200 It can be any variety of different scenarios where the workflow needs to be automated. 75 00:09:12,300 --> 00:09:20,560 However, you get to a point where, you know, you want to be able to have a more defined workflow. 76 00:09:20,560 --> 00:09:21,920 Let's say you have deployed it. 77 00:09:21,920 --> 00:09:23,020 You've exposed your endpoint. 78 00:09:23,020 --> 00:09:36,200 So, typically, the end result of the fairing workflow is some sort of an endpoint where you have the ability to pass it on to your UI team, for instance, to build a simple UI around it. 79 00:09:36,420 --> 00:09:39,900 Or you have some other downstream service consuming it. 80 00:09:39,900 --> 00:09:43,100 So, that's as far as fairing gets you. 81 00:09:43,100 --> 00:09:45,560 And you can get that from the notebook or from a repeatable process. 82 00:09:45,560 --> 00:10:00,980 But what if you have a complex end-to-end process that requires a lot of many different steps that fail and you want to isolate each of those steps and control the security permission model on each individual part of the DAG. 83 00:10:00,980 --> 00:10:03,620 So, that's where Kubeflow Pipelines comes in. 84 00:10:04,160 --> 00:10:10,400 So, Pipelines is a different component I wanted to introduce you to before we jump into what you can do to make these deployments secure. 85 00:10:10,540 --> 00:10:13,880 It's a UI for managing experiments, jobs, and runs. 86 00:10:13,880 --> 00:10:25,040 So, it's also an SDK that effectively allows you to break down your entire end-to-end workflow into a number of containerized operations. 87 00:10:25,820 --> 00:10:39,720 So, instead of thinking in terms of an entire function that does a number of different things, from data preprocessing to outlier removal to training and then tuning, you can imagine your scenario. 88 00:10:39,720 --> 00:10:44,320 You isolate each component of that workflow into its own component. 89 00:10:44,320 --> 00:10:52,500 And you have the Docker image or something that captures the requirements of your model in one place. 90 00:10:52,500 --> 00:10:57,180 And you then can add things like monitoring to it. 91 00:10:57,180 --> 00:11:03,100 And all you have to do is to follow a number of standard interfaces that are defined in the container ops spec. 92 00:11:03,540 --> 00:11:08,800 So, the benefit of that is to be able to not only 93 00:11:12,040 --> 00:11:25,640 get performance out of your models by addressing bottlenecks, but you can also freeze a version of your model in time by looking at the exact image that was used to run at any given step of the model. 94 00:11:25,640 --> 00:11:34,040 So, if your goal is reproducibility, which I think it should be, you can get back to exact versions of containers that were used to run your model. 95 00:11:34,260 --> 00:11:35,100 So, 96 00:11:38,640 --> 00:11:40,660 visualization of the DAG might look like this. 97 00:11:40,660 --> 00:11:45,400 So, that's an example of the XGBoost run that you can find in the docs. 98 00:11:45,400 --> 00:11:54,180 So, as you can see, the operations here are not limited to just the ML tasks, like, you know, training and transformation of the data. 99 00:11:54,180 --> 00:11:55,720 But things like creating clusters. 100 00:11:55,720 --> 00:12:03,380 And if you go a few slides back, we can find that we have access to pods, deployment services, and jobs. 101 00:12:03,380 --> 00:12:13,280 So, you can not only do the modeling, but everything required for it in terms of infrastructure and service requirements that are needed. 102 00:12:13,280 --> 00:12:17,840 And then introduce monitoring and outputs in intermediate steps. 103 00:12:17,840 --> 00:12:26,560 So, one of the things you could do is visualize the HTML output of the Jupyter notebook that gives you some reference metrics for how well your model is doing. 104 00:12:26,560 --> 00:12:29,780 Or visualize a confusion matrix or an ROC curve. 105 00:12:29,780 --> 00:12:33,900 Something that will give you a way of visually debugging it. 106 00:12:33,900 --> 00:12:36,940 Which is one more place where the notebooks sort of make an appearance. 107 00:12:36,940 --> 00:12:46,920 You can take the same fairy notebooks that you use for analysis and integrate them into these intermediate steps as a form of, like, debugging intermediate steps. 108 00:12:47,680 --> 00:12:54,240 This is a diagram of what happens behind the scenes as far as allowing it to happen. 109 00:12:54,240 --> 00:13:03,760 So, if you actually look at the way pipelines are implemented, they're Argo workflows with a very thin sort of layer that makes it adaptable to Kubeflow pipelines. 110 00:13:03,760 --> 00:13:15,700 But if you are familiar with Argo, everything that Argo normally gets you, which is event driven workloads, isolation of individual steps, and you get with it. 111 00:13:15,700 --> 00:13:21,620 And so, in the recent version, you actually have the metadata store. 112 00:13:21,620 --> 00:13:25,480 So, every run of a Kubeflow pipeline is versioned. 113 00:13:25,480 --> 00:13:35,280 And the information about it is stored into a metadata database, which is a MySQL database with a JSON schema that allows you to track artifacts . 114 00:13:35,280 --> 00:13:38,900 The artifacts are pipelines or individual container operations in the pipeline. 115 00:13:39,620 --> 00:13:48,900 Once again, it's a lot of opportunity to mess up and expose some part of the architecture to the outside world. 116 00:13:48,900 --> 00:13:56,020 So, it's imperative that we talk more about how we isolate that. 117 00:13:57,960 --> 00:14:04,740 And as you can see, the entire architecture is quite complex. 118 00:14:04,740 --> 00:14:10,260 So, this talks a little bit about the domain specific language that Kubeflow pipelines gives you. 119 00:14:10,260 --> 00:14:13,620 So, you have container ops, pipeline parameters, components. 120 00:14:14,200 --> 00:14:23,880 There are a number of standard components that come with prebuilt containers and images that allow you to run simple Python functions that don't require a lot of dependencies. 121 00:14:24,260 --> 00:14:28,660 There are operations that allow you to handle volumes. 122 00:14:28,660 --> 00:14:38,420 So, you can actually create a data store that's needed for your storage of intermediate artifacts, like weights on your model or some debugging outputs. 123 00:14:38,700 --> 00:14:38,800 And 124 00:14:41,840 --> 00:14:46,960 this is an example of a specification, like a lot of things in Granny's world, you define it using YAML. 125 00:14:46,960 --> 00:14:53,700 So, as long as you are consistent in what inputs, outputs each individual step takes. 126 00:14:53,700 --> 00:15:11,040 So, you can attach an image to it and you can actually run a train command that or any other sort of entry point that will take arguments and allow you to execute a specific workload in a specific manner with a number of arguments that will power it. 127 00:15:11,180 --> 00:15:12,620 What does it get us? 128 00:15:12,960 --> 00:15:17,600 Take a step back from the concrete detail over there. 129 00:15:17,600 --> 00:15:33,720 It gets us a standard reusable component structure that allows us to take our work and be able to take it with us or generalize it to problems that we might encounter down the line. 130 00:15:33,720 --> 00:15:49,620 So, instead of learning a specific stack at one of the big four, we can actually go ahead and build in a manner that is shareable and is available to be executed anywhere. 131 00:15:49,620 --> 00:15:53,360 So, as a Google project, it initially had more contributors from Google. 132 00:15:53,600 --> 00:15:58,160 It recently passed the point where a majority of contributors actually come from the community. 133 00:15:58,360 --> 00:16:04,640 David Aronchik, the person who started as a PM of the project with Google, is now at Microsoft and bringing it to Azure. 134 00:16:04,640 --> 00:16:11,600 So, it's got broad support by the community and it's a community -driven project. 135 00:16:12,460 --> 00:16:21,660 In the future, you can imagine individual pieces of your pipelines becoming shared with others in a reusable manner. 136 00:16:21,660 --> 00:16:25,020 So, that's it about Kubeflow. 137 00:16:25,140 --> 00:16:26,900 I just wanted to give you a brief introduction. 138 00:16:26,900 --> 00:16:28,020 There's a lot more to it. 139 00:16:28,020 --> 00:16:37,420 And that's just scratching the surface by looking at these two components that get you from notebook interface to something that's event-driven and triggerable and reusable. 140 00:16:37,420 --> 00:16:44,100 So, I want to talk about benefits of this approach and how we think about security in Kubeflow. 141 00:16:44,100 --> 00:16:51,400 So, principle of least privilege, I think, is a benefit not just for this project, but Kubernetes in general. 142 00:16:51,400 --> 00:17:00,440 And then it's a good argument for running things in containers in the first place instead of having one service account with access to everything in your infrastructure. 143 00:17:00,440 --> 00:17:05,800 You can isolate your workloads by specific tasks that they're needed to perform. 144 00:17:06,060 --> 00:17:13,300 So, in this case, you can think about a container operation that needs to read data from a Google Cloud Storage bucket. 145 00:17:13,980 --> 00:17:22,240 The service accounts, the secrets that you expose to that container do not need to have anything beyond that. 146 00:17:22,240 --> 00:17:31,140 And if there is a vulnerability in some component of that container or if the container gets compromised, you don't lose access to the entire infrastructure. 147 00:17:31,140 --> 00:17:34,520 So, once again, to inform you what is happening now. 148 00:17:34,520 --> 00:17:40,400 And for context, a lot of this is still not like GA or it's not 1.0 version. 149 00:17:40,400 --> 00:17:43,140 So, the latest stable version is 0.6. 150 00:17:44,300 --> 00:17:49,720 Security tends to take a backseat when rapid development is a goal. 151 00:17:49,720 --> 00:17:53,120 And so, right now is the time to start thinking about how can we improve this? 152 00:17:53,120 --> 00:18:07,220 And so, my goal is to, by informing you, let you get to the GitHub, play with the code, see what you can do, see how you can break and hopefully open some issues and pull requests to help us do better. 153 00:18:07,760 --> 00:18:16,880 So, from that perspective, I will introduce you to the three service accounts and permissions that are currently deployed with them. 154 00:18:16,880 --> 00:18:27,580 So, we have... and a lot of this maps into the on-premise deployment, but of necessity, Google Cloud Platform has been more of a stable target for Kubeflow as of now. 155 00:18:27,580 --> 00:18:41,860 So, if you're dealing in the on-premise environment, I think things like IAM roles I'll be describing now, they're more specific to Google Cloud Platform and won't translate as easily to your on-premise role-based authentication. 156 00:18:42,360 --> 00:18:50,040 So, one service account is admin and it's used to actually deploy and configure the cluster. 157 00:18:50,060 --> 00:19:00,200 So, you can find the KFCTL script that is going to use the admin service account to perform most of the deployments. 158 00:19:00,200 --> 00:19:05,920 User is what most data scientists will encounter in their day-to-day. 159 00:19:05,920 --> 00:19:15,200 So, that allows you to use and consume GCP resources and interact with GCP resources from your container operations or fairing if you're using a Jupyter notebook. 160 00:19:15,360 --> 00:19:25,700 And we have the logging account as well, which uses VM, which is called VM and it's used to take audit logs and send them to Stackdriver. 161 00:19:25,700 --> 00:19:32,600 So, as far as concrete roles for the account, and all of these can be adjusted, by the way. 162 00:19:32,600 --> 00:19:37,360 So, this is taken directly from a Cloud Deployment Manager template that you can find in the repository. 163 00:19:38,260 --> 00:19:45,240 The admin service account has source admin, which is allowing you to push the application to Cloud Repository. 164 00:19:45,740 --> 00:19:51,720 It has the management account, which allows you to control the endpoints and the host names of those endpoints. 165 00:19:52,500 --> 00:20:05,120 Network admin is used to enable identity-aware proxy, which allows you to use your Google account to authenticate against different resources and consume them, as well as health checks. 166 00:20:05,120 --> 00:20:06,620 So, that's the admin account. 167 00:20:06,620 --> 00:20:14,180 If you wanted to change these, you would add things to the template, but that would be specific to your organization's security policy. 168 00:20:14,860 --> 00:20:25,460 The user service account allows you to do things like build custom things in Container Builder. 169 00:20:25,460 --> 00:20:35,260 That's important if you want to run your application in the context where you don't have access to GCR, Google Container Registry. 170 00:20:35,260 --> 00:20:48,240 And so, the builder allows you to actually package it up as a coherent sort of end-to-end application and deploy it potentially in an air-gapped environment, which could be a concern for security. 171 00:20:49,140 --> 00:20:53,820 You can have a viewer role for actually viewing the resources of the builds. 172 00:20:53,820 --> 00:20:56,080 And then, this is just an example. 173 00:20:56,080 --> 00:20:57,340 Your services may vary. 174 00:20:57,340 --> 00:20:59,880 So, for instance, you want to add Dataproc or something. 175 00:20:59,880 --> 00:21:12,300 This is not currently captured here, but this is a minimal set of permissions for interacting with Cloud Storage buckets, BigQuery, Dataflow, all of which will probably help you with data. 176 00:21:13,760 --> 00:21:18,480 And then, of course, the monitoring account, Log Writer, Metric Writer, and Object Viewer. 177 00:21:18,480 --> 00:21:24,000 So, these are the roles that you can review and decide whether they're appropriate or not. 178 00:21:24,000 --> 00:21:27,020 One of the things that hasn't been mentioned in the earlier slide is an IAP account. 179 00:21:27,020 --> 00:21:34,600 So, this actually goes to your user account that authenticates against Identity-Aware Proxy. 180 00:21:34,600 --> 00:21:41,140 So, you have to be able to have an Object Viewer role on that as a part of the implementation. 181 00:21:42,120 --> 00:21:46,560 And then, VM Service Account, like I said, has Log Writer and all that. 182 00:21:46,560 --> 00:21:46,880 So, okay. 183 00:21:46,880 --> 00:21:53,980 So, that's based on Kubeflow's built-in roles right now. 184 00:21:55,440 --> 00:22:02,440 The way that it relates to role-based authentication in Kubernetes is it complements it. 185 00:22:02,440 --> 00:22:08,040 So, when you are trying to define that, IAM can only get you so far. 186 00:22:08,040 --> 00:22:17,480 And it's probably better for metadata and access to other objects that are accessible through IAM and controlled through IAM roles. 187 00:22:17,480 --> 00:22:31,560 If you wanted to actually interact with Kubernetes permissions themselves, you could create other objects like cluster roles and cluster bindings that will help you control the management of your resources using the Kubernetes model. 188 00:22:31,560 --> 00:22:37,460 So, once again, I point you to resources towards the end where this can be addressed in more detail. 189 00:22:39,500 --> 00:22:44,120 So, this is a brief description of how that works. 190 00:22:45,080 --> 00:22:54,500 And just to clarify, one thing is that at point six, we now have per user namespace isolation. 191 00:22:54,500 --> 00:23:04,440 So, if you start with a new project and you add your own user, all of your pods, notebook services, endpoints that you deploy will be contained to that namespace. 192 00:23:04,440 --> 00:23:10,440 And so, other data scientists or other teams may not necessarily have access to your namespace. 193 00:23:10,440 --> 00:23:13,900 That buys you multi-tenancy and things like that. 194 00:23:13,900 --> 00:23:25,940 So, it's important to, for instance, if you are in a context where certain projects require a separate set of NDAs or have some PII that should not be accessible outside of your particular analysis. 195 00:23:28,400 --> 00:23:28,840 Okay. 196 00:23:28,840 --> 00:23:32,380 So, the gist of this talk is actually quite simple. 197 00:23:32,380 --> 00:23:36,500 There are two main things you can do as a data scientist when deploying this. 198 00:23:36,500 --> 00:23:40,880 My goal is for you to go back to your place of employment and try this. 199 00:23:40,880 --> 00:23:48,560 And when you try it, I don't want you to add cryptocurrency miners to your company's infrastructure. 200 00:23:48,560 --> 00:23:52,780 So, a few simple precautions can help you avoid that. 201 00:23:52,780 --> 00:23:57,640 So, the main one, honestly, is the VPC service control idea. 202 00:23:57,640 --> 00:24:12,620 So, what that allows you to do is to restrict access to certain API endpoints that will be consumed by your application to only the services and pods that come from within your Kubeflow deployment. 203 00:24:12,740 --> 00:24:14,620 VPC service control model. 204 00:24:16,900 --> 00:24:26,720 Gives you the secure perimeter within which only the clients that are authorized can have private access to resources, create them, copy them. 205 00:24:26,720 --> 00:24:33,040 And so, to be clear, this only applies to the content within those resources, not the metadata about those resources. 206 00:24:33,040 --> 00:24:36,460 If you wanted to manage the metadata, you would have to fall back on the IAM models. 207 00:24:36,460 --> 00:24:54,680 So, if you're trying to copy things from Google Cloud Storage or do things in BigQuery, if you want to make sure that your team in a different geographic locale will not have the same access, you just use VPC service controls to isolate them. 208 00:24:55,160 --> 00:25:02,880 So, these are some of the benefits that allow you to... that I could go into more detail on if there are any questions. 209 00:25:02,880 --> 00:25:11,400 But effectively, it's configurable using standard credentials. 210 00:25:11,860 --> 00:25:15,660 You have ability to restrict it by service. 211 00:25:16,040 --> 00:25:18,780 And here's an example of how you would do that. 212 00:25:18,780 --> 00:25:21,420 Of course, all of these environment variables actually have to be set. 213 00:25:22,140 --> 00:25:33,120 But this is the command line approach in which case you enable the resource manager API and the other prerequisite steps. 214 00:25:33,840 --> 00:25:37,460 There are similar ways of defining a secure perimeter in the UI in GCP. 215 00:25:37,460 --> 00:25:41,080 Once again, this would be different on your actual on-premise deployment. 216 00:25:41,080 --> 00:25:51,680 But you could say that your application should only be able to access PubSub or Storage API and should not be able to access Bigtable or other services within the perimeter. 217 00:25:51,680 --> 00:25:57,420 And you can restrict it to specific projects which in GCP land have come with their own set of isolations. 218 00:25:57,420 --> 00:26:06,680 So, when you're setting it up and trying to justify it to your boss, just make sure to say that you will not have issues with some high security service. 219 00:26:06,680 --> 00:26:09,780 Let's say BigQuery has all of your critical data. 220 00:26:10,920 --> 00:26:26,960 Another thing you can do, and I recommend doing this especially if you're exposing any resources that have a load balancer in front of them, restrict it by authorized networks by using a specific IP range that you'll be heading them from. 221 00:26:26,960 --> 00:26:33,640 So, it's something that can save you from unfortunate outcomes. 222 00:26:33,840 --> 00:26:38,980 Here's another command line example of what you saw earlier in the UI. 223 00:26:38,980 --> 00:26:41,800 So, in this case, you once again define a secure perimeter. 224 00:26:41,800 --> 00:26:49,000 But that's something that you can automate for creation of new projects either with Cloud Deployment Manager Terraform or other tool like that. 225 00:26:49,280 --> 00:26:51,700 Don't make it a guesswork every time. 226 00:26:52,320 --> 00:27:03,500 And try to you know, fall back on good practices and discuss with your team and understand like what is within your security budget. 227 00:27:03,500 --> 00:27:06,700 So, effectively, we have different APIs here. 228 00:27:06,700 --> 00:27:09,960 In this case, we're enabling BigQuery container registry and storage. 229 00:27:09,960 --> 00:27:12,920 But you know, your use case may vary. 230 00:27:12,920 --> 00:27:19,620 And so, I added some diagrams in case you wanted to see practically what this gives you. 231 00:27:19,620 --> 00:27:33,300 So, once you have a certain service perimeter that allows within which you run Kubeflow, you will not have to worry about unauthorized access from outside world or other clients that will consume it in ways that you didn't intend. 232 00:27:33,320 --> 00:27:35,240 This is the case for cloud. 233 00:27:35,240 --> 00:27:40,520 The on-premise situation a little bit more complicated, especially with GKE on-prem and Anthos. 234 00:27:41,400 --> 00:27:45,540 You know, you can have these things a bit more configured. 235 00:27:45,540 --> 00:27:49,100 But once again, this has been mostly GCP focused. 236 00:27:49,100 --> 00:28:00,220 In this case, you can extend your VPC perimeter into a on-premise network by using some sort of a VPN gateway that could come with its own subnet. 237 00:28:00,220 --> 00:28:08,060 And by defining strict firewall rules for how different VPCs talk to each other, you can prevent that from happening. 238 00:28:08,060 --> 00:28:15,480 Honestly, if you get to this point, you should probably work with your own operations as DLC teams. 239 00:28:15,480 --> 00:28:25,540 But as a one-off experiment, I recommend just running on GCP and configuring very basic service perimeter like so. 240 00:28:26,600 --> 00:28:28,120 One last step. 241 00:28:28,120 --> 00:28:36,640 I think it may seem obvious, but one of the most common ways GCP accounts get compromised is service account leakage. 242 00:28:36,640 --> 00:28:41,100 It's either somebody commits to GitHub or, like, that can happen. 243 00:28:41,220 --> 00:28:48,780 Especially for newer data analysts, data scientists, a lot of the tutorials advise you to add everything in your directory to get committed. 244 00:28:48,780 --> 00:28:51,860 So that's how a lot of that stuff happens. 245 00:28:51,860 --> 00:28:53,060 It's a true story. 246 00:28:54,060 --> 00:29:01,760 Luckily, Kubernetes allows you to store credentials in a secure manner that can be accessed from a variety of places in Kubeflow infrastructure. 247 00:29:01,760 --> 00:29:05,040 And I wanted to show you how to go through that really briefly. 248 00:29:05,040 --> 00:29:08,980 So you can add a secret by using standard secret creation interface. 249 00:29:08,980 --> 00:29:13,360 Secret can be a service account, JSON, environment variable that you set. 250 00:29:13,440 --> 00:29:19,500 I recommend using secrets for anything JSON or even the passwords that you want to consume later. 251 00:29:20,480 --> 00:29:36,640 You can spread the credentials to your entire infrastructure by using Google application credentials, which is your environment variable that stores your service account files and that every pod that will start with a certain service account within your cluster will have access to those resources. 252 00:29:36,640 --> 00:29:39,360 Let's say there is something every pod has to hit. 253 00:29:41,160 --> 00:29:45,700 Once again, per namespace, so you don't have to worry about leaking to your colleagues. 254 00:29:46,260 --> 00:29:54,220 You can authenticate from the pod directly by picking it up from a secret store and mounting a GCP secret as a volume. 255 00:29:54,440 --> 00:30:01,100 Once again, this environment variable is how your SDK will know what to authenticate with. 256 00:30:01,540 --> 00:30:03,680 You can access secrets from a pipeline. 257 00:30:03,680 --> 00:30:10,260 So if you remember the components earlier, it's part of the DSL to be able to include a specific secret into your pipeline. 258 00:30:10,260 --> 00:30:16,160 So think of this as a critical step. 259 00:30:16,160 --> 00:30:35,200 So it may be very tempting to add your secret to your Docker image if you're on a deadline, but if you just follow these simple procedures and you add secrets by using the DSL directly, you're preventing unnecessary harm from leaking your service accounts to your registry. 260 00:30:36,220 --> 00:30:40,900 Lastly, I had a little bit of material on the .6 edition, which just happened. 261 00:30:40,900 --> 00:30:45,700 What migration from .5 was the replacement of Ambassador Proxy with the Istio gateway. 262 00:30:45,700 --> 00:31:01,960 And at this point, it may not be as relevant to a day-to-day use by data scientists, but Istio comes with a number of very nice ways of controlling flow of data and security between different services in your cluster. 263 00:31:01,960 --> 00:31:14,860 And so you get a lot of things for free, like AuthC, authentication, authorization, and things like fault injections, which allow you to test your model. 264 00:31:14,860 --> 00:31:21,060 And so I'll wrap up real quick, but I wanted to point you to some resources and references. 265 00:31:21,060 --> 00:31:22,260 So Kubeflow.org is great. 266 00:31:22,260 --> 00:31:25,640 There are private clusters, description over there. 267 00:31:25,640 --> 00:31:33,980 And a lot of this material came from Kubeflow documentation, and as well as the blog post by Arikto, which did a really good write-up on authentication. 268 00:31:33,980 --> 00:31:37,080 Please join our Slack, start contributing. 269 00:31:37,080 --> 00:31:42,540 We need security people to look at this before it hits 1.0 so that we don't have nasty surprises down the line. 270 00:31:42,980 --> 00:31:43,660 And thank you. 271 00:31:43,660 --> 00:31:47,620 You can find me on Twitter, Keybase, GitHub, or feel free to email me directly.