{"id":28739809,"url":"https://github.com/codingforentrepreneurs/try-knative","last_synced_at":"2025-07-27T16:35:41.025Z","repository":{"id":82300949,"uuid":"584985239","full_name":"codingforentrepreneurs/try-knative","owner":"codingforentrepreneurs","description":"Learn how to deploy serverless containerized apps on Kubernetes with Knative.","archived":false,"fork":false,"pushed_at":"2023-10-23T16:37:27.000Z","size":15,"stargazers_count":7,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-10T01:58:38.490Z","etag":null,"topics":["cert-manager","container-orchestration","containers","custom-domains","docker","https","istio","k8s","knative","kubernetes","linode","lke","serverless","tls"],"latest_commit_sha":null,"homepage":"https://www.codingforentrepreneurs.com/courses/try-knative/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codingforentrepreneurs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-04T02:47:06.000Z","updated_at":"2024-09-17T04:09:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"360f9c8d-84a8-46cf-b0c7-a39f2e5e3b08","html_url":"https://github.com/codingforentrepreneurs/try-knative","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codingforentrepreneurs/try-knative","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2Ftry-knative","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2Ftry-knative/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2Ftry-knative/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2Ftry-knative/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingforentrepreneurs","download_url":"https://codeload.github.com/codingforentrepreneurs/try-knative/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2Ftry-knative/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260109606,"owners_count":22960037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cert-manager","container-orchestration","containers","custom-domains","docker","https","istio","k8s","knative","kubernetes","linode","lke","serverless","tls"],"created_at":"2025-06-16T06:10:55.926Z","updated_at":"2025-06-16T06:10:56.575Z","avatar_url":"https://github.com/codingforentrepreneurs.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Try Knative Logo](https://static.codingforentrepreneurs.com/media/courses/knative-serverless-kubernetes/df87329c-3d26-4358-b913-5ed037dabd8b.jpg)](https://www.codingforentrepreneurs.com/courses/try-knative/)\n\n# Try Knative\nThis repository is the reference code for our in-depth course [Try Knative](https://www.codingforentrepreneurs.com/courses/try-knative/) along with the related article on [our blog](https://www.codingforentrepreneurs.com/blog/try-knative-on-lke).\n\nThere are a few requirements before you get started.\n\n## Requirements\n- Watch [Terraforming Kubernetes on Linode](https://www.codingforentrepreneurs.com/courses/terraforming-kubernetes-on-linode/) or have experience with Kubernetes clusters\n- [Git](https://git-scm.com/downloads) installed\n- [Terraform](https://developer.hashicorp.com/terraform/downloads) installed\n- [Kubectl](https://kubernetes.io/docs/tasks/tools/) installed\n\nIf you have all of these complete, let's do this.\n\n## 1. Clone this repo\nI have modified the [Terraforming Kubernetes Rapid-Fire](https://github.com/codingforentrepreneurs/terraforming-kubernetes-rapid) repo for this project. I removed the `git` history and `k8s.yaml` file.\n\n```\ngit clone https://github.com/codingforentrepreneurs/try-knative\ncd try-knative\n```\nOnce you clone this repo, you'll have a `installers/install-knative.sh` file that will install Knative Serving and Istio on your Kubernetes cluster based on their standard installation instructions. More on this in a bit.\n\nIf you want to start fresh, checkout the `fresh` branch and remove the git history\n\n```\ngit checkout fresh\nrm -rf .git\ngit init\n```\nNow you have a fresh repo that includes only the code for the rest of this README.\n\n## 2. Initialize Terraform\nCreate an account on [Linode](https://www.linode.com/cfe) and get an API Key in your linode account [here](https://cloud.linode.com/profile/tokens).\n\nOnce you have a key, do the following:\n\n```bash\necho \"linode_api_token=\\\"YOUR_API_KEY\\\"\" \u003e\u003e terraform.tfvars\necho \"k8s_node_type=\\\"g6-standard-2\\\"\" \u003e\u003e terraform.tfstate\n```\n\nThrough my tests, the minimum node instance type we need to use for Knative is `g6-standard-2` with a minimum of 3 nodes in the cluster.\n\nNow run\n```bash\nterraform init\n```\nBe sure that if you're using _git_ that you have at least [this .gitignore](./blob/main/.gitignore) file in your repo.\n\n\n## 3. Add Autoscaling to your Kubernetes Cluster\n\nIn `infra.tf`, we'll update the `linode_lke_cluster.terraform_k8s` resource to add autoscaling to our cluster and update the `k8s_version` to `1.25`.\n\n```hcl\nresource \"linode_lke_cluster\" \"terraform_k8s\" {\n    k8s_version=\"1.25\"\n    label=\"try-knative\"\n    region=\"us-east\"\n    tags=[\"try-knative\"]\n     pool {\n        type  = var.k8s_node_type\n        count = 3\n        autoscaler {\n            min = 3\n            max = 8\n        }\n    }\n}\n```\n\nThe `autoscaler` declaration will ensure that Kubernetes has as many nodes as it needs to run your containerized applications. LKE will manage this for you without further intervention. The _autoscaler_ has strange behavior in Terraform so we'll update it in a bit.\n\n_Optional_: I also updated the `label`, and `tags` to be `try-knative` instead of `terraform-k8s` for this project. You should update them as you see fit. I left the name of Terraform resource `linode_lke_cluster` as `terraform_k8s` in order to limit how much of `infra.tf` we need to change. \n\n\n## 4. Terraform your Kubernetes Cluster\n\n```bash\nterraform apply\n```\n\u003e Use `terraform apply -auto-approve` if you're really in a hurry.\n\n\n## 5. Update Terraform Lifecycle to ignore Autoscaling Changes\n\nAdding the autoscaling declaration in our LKE resource is a bit wonky because Terraform  will _constantly_ try to update your cluster to the declare document state.\n\nFor example, if LKE autoscaled your cluster to 5 nodes, Terraform will try to update your cluster to 3 nodes. To fix this, we can just _ignore_ changes to the `pool` declaration until we want to explicitly change it.\n\n```hcl\nresource \"linode_lke_cluster\" \"terraform_k8s\" {\n    k8s_version=\"1.24\"\n    label=\"terraform-k8s\"\n    region=\"us-east\"\n    tags=[\"terraform-k8s\"]\n     pool {\n        type  = var.k8s_node_type\n        count = 3\n        autoscaler {\n            min = 3\n            max = 8\n        }\n    }\n    lifecycle {\n        ignore_changes = [\n            pool,\n        ]\n        create_before_destroy = true\n    }\n}\n```\n\n\n## 6. Install Knative Serving and Istio\n\nKnative Serving is the core Kubernetes component that allows you to run serverless containerized applications. Istio is a service mesh that allows you to manage traffic between your applications and, for our case, with the outside world.\n\nYou can install them on these links _or_ our bash script below:\n\n- Install [Knative Serving Docs](https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#install-the-knative-serving-component)\n- Install [Knative + Istio Installation Docs](https://knative.dev/docs/install/yaml-install/serving/install-serving-with-yaml/#install-a-networking-layer)\n\n\nThe macOS/Linux bash script is avaiable in this repo at: [installers/install-knative-istio.sh](./blob/main/installers/install-knative-istio.sh). Let's run it with now:\n\n```bash\nchmod +x ./installers/install-knative-istio.sh\n./installers/install-knative-istio.sh\n```\n\nAt this time, it's recommended that Windows users use the links for _Knative Serving_ and _Knative + Istio_ installation from above.\n\n\n## 7. Confirm Installation\n\nWhen you run `./installers/install-knative-istio.sh`, you should see the output related to your knative/istio installation. Here's the command we can run again to get our Knative Ingress IP address. If you're using Linode and LKE, this IP Address is configured from a Linode load balancing service called NodeBalancers which is how we can have Kubernetes provide us another IP Address.\n\n```bash\nkubectl --namespace istio-system get service istio-ingressgateway\nexport KNATIVE_INGRESS_IP=$(kubectl --namespace istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')\n\necho \"Your IP Address is: $KNATIVE_INGRESS_IP\"\necho \"Add a cname record for your domain using the above IP address.\"\n```\n\n## 8. Knative Installed!\n\nAt this point, I recommend you review our [Try Knative article](https://www.codingforentrepreneurs.com/blog/try-knative-on-lke) on deploying containers with Knative services, mapping domains, and more!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Ftry-knative","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingforentrepreneurs%2Ftry-knative","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Ftry-knative/lists"}