github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/docs/5-jackal-tutorials/9-resource-adoption.md (about) 1 # Adopt Pre-Existing Resources 2 3 ## Introduction 4 5 In this tutorial, you will create a test workload prior to initializing Jackal. After that you will then use Jackal to adopt those workloads, so you can manage their future lifecycle with Jackal. 6 7 ## System Requirements 8 9 - You'll need an internet connection to grab the Jackal Init Package if it's not already on your machine. 10 11 ## Prerequisites 12 13 - Prior to this tutorial you'll want to have a working cluster. But unlike our other tutorials you **don't want Jackal initialized**. 14 15 - Jackal binary installed on your $PATH: ([Installing Jackal](../1-getting-started/index.md#installing-jackal)) 16 17 ## Youtube Tutorial 18 [](https://youtu.be/r3TBpMXtuNY "Adopt Pre-Existing Resources to Manage with Jackal") 19 20 ## Creating a Test Component 21 We're going to use the manifests from the [Deploying a Retro Arcade](./3-deploy-a-retro-arcade.md) tutorial for this example. So if you haven't yet, clone the Jackal repository, and navigate to the cloned repository's root directory. 22 23 1. Create the dos-games namespace 24 25 <iframe src="/docs/tutorials/resource_adoption_namespace.html" width="100%" height="85px"></iframe> 26 27 2. Use the dos-games example manifests, to deploy the dos-games deployment and service to your Kubernetes cluster. 28 29 <iframe src="/docs/tutorials/resource_adoption_manifests.html" width="100%" height="110px"></iframe> 30 31 ## Test to see that this is working 32 33 1. Use the `kubectl port-forward` command to confirm you've deployed the manifests properly. 34 35 <iframe src="/docs/tutorials/resource_adoption_forward.html" width="100%" height="80px"></iframe> 36 37 2. Navigate to `http://localhost:8000` in your browser to view the dos-games application. It will look something like this: 38 39  40 41 :::note 42 43 Remember to press `ctrl+c` in your terminal when you're done with the port-forward. 44 45 ::: 46 47 ## Initialize Jackal 48 49 1. Use the [Initializing a K8s Cluster](./1-initializing-a-k8s-cluster.md) tutorial, to initialize Jackal in the cluster. 50 51 :::note 52 53 You'll notice the dos-games namespace has been excluded from Jackal management as it has the `jackal.dev/agent=ignore` label. This means that Jackal will not manage any resources in this namespace. 54 55 <iframe src="/docs/tutorials/resource_adoption_ignored.html" width="100%" height="175px"></iframe> 56 57 ::: 58 59 The iframe was pointing to the wrong file, and this likely would be better as an admonition. 60 61 ## Deploy the Package, Adopting the Workloads 62 63 1. Use the `jackal package deploy` command with the `--adopt-existing-resources` flag to adopt the existing dos-games resources in the `dos-games` namespace. 64 65 <iframe src="/docs/tutorials/resource_adoption_deploy.html" width="100%" height="600px"></iframe> 66 67 :::caution 68 69 Notice that in this example the dos-games resources were contained in their own namespace. When running a deploy with `--adopt-existing-resources` it is recommended that this be the case as you could break other non-Jackal deployments if resources are shared. 70 71 ::: 72 ## Test to see that this is working 73 74 1. You'll notice the dos-games namespace is no longer excluded from Jackal management as it has the `app.kubernetes.io/managed-by=jackal` label. This means that Jackal will now manage any resources in this namespace. 75 76 <iframe src="/docs/tutorials/resource_adoption_adopted.html" width="100%" height="120px"></iframe> 77 78 2. You can also now use the `jackal connect` command to connect to the dos-games application. Again it will look something like this. 79  80 81 :::note 82 83 Again, remember to press `ctrl+c` in your terminal, when you're done with the connection. 84 85 <iframe src="/docs/tutorials/resource_adoption_connect.html" width="100%"></iframe> 86 87 ::: 88 89 ## Conclusion 90 91 At this point the dos-game package is managed by Jackal and will behave just like a package initially deployed with Jackal.