{"id":13581955,"url":"https://github.com/Trendyol/kink","last_synced_at":"2025-04-06T10:33:08.917Z","repository":{"id":37073855,"uuid":"402151087","full_name":"Trendyol/kink","owner":"Trendyol","description":"KinK is a helper CLI that facilitates to manage KinD clusters as Kubernetes pods. Designed to ease clusters up for fast testing with batteries included in mind.","archived":false,"fork":false,"pushed_at":"2025-03-17T20:56:05.000Z","size":3600,"stargazers_count":377,"open_issues_count":19,"forks_count":28,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-22T05:33:01.299Z","etag":null,"topics":["cobra","go","go-cli","kind","kind-in-kubernetes","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Trendyol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-01T17:42:18.000Z","updated_at":"2025-02-03T19:21:23.000Z","dependencies_parsed_at":"2025-01-30T12:22:21.397Z","dependency_job_id":"f97d5ad7-a7ca-4322-985a-70dffcb48488","html_url":"https://github.com/Trendyol/kink","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trendyol%2Fkink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trendyol%2Fkink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trendyol%2Fkink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Trendyol%2Fkink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Trendyol","download_url":"https://codeload.github.com/Trendyol/kink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247470550,"owners_count":20944146,"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":["cobra","go","go-cli","kind","kind-in-kubernetes","kubernetes"],"created_at":"2024-08-01T15:02:20.860Z","updated_at":"2025-04-06T10:33:05.118Z","avatar_url":"https://github.com/Trendyol.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"kink Logo\" src=\"https://github.com/marcusolsson/gophers/raw/master/viking.png?v=3\u0026s=200\" height=\"200\" /\u003e\n  \u003ch3 align=\"center\"\u003ekink\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eA helper CLI that facilitates to manage KinD clusters as Kubernetes pods.\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n  \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"Apache 2.0\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/Trendyol/kink\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/Trendyol/kink\" alt=\"Go Report\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Trendyol/kink/actions?workflow=test\"\u003e\u003cimg src=\"https://img.shields.io/github/workflow/status/Trendyol/kink/release\" alt=\"Build Status\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Trendyol/kink/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/release/Trendyol/kink.svg\" alt=\"GitHub release\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/Trendyol/kink/\"\u003e\u003cimg src=\"https://img.shields.io/github/go-mod/go-version/Trendyol/kink\" alt=\"Go Mod\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/Trendyol/kink\"\u003e\u003cimg src=\"https://codecov.io/gh/Trendyol/kink/branch/main/graph/badge.svg\" alt=\"Codecov\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003c/p\u003e\n\n---\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n![kink_v1.gif](./assets/kink_v1.gif)\n\n\n## Table of Contents\n\n- [kink (KinD in Kubernetes)](#kink-kind-in-kubernetes)\n    - [Introduction](#introduction)\n    - [How it works ?](#how-it-works-)\n        - [Architectural Diagram](#architectural-diagram)\n    - [Installation](#installation)\n    - [Quick Start](#quick-start)\n        - [List supported Kubernetes versions](#list-supported-kubernetes-versions)\n        - [Run KinD cluster](#run-kind-cluster)\n        - [List KinD clusters](#list-kind-clusters)\n        - [Delete KinD clusters](#delete-kind-clusters)\n    - [Autocompletion Support](#autocompletion-support)\n        - [Bash](#bash)\n        - [Zsh](#zsh)\n        - [fish](#fish)\n        - [PowerShell](#powershell)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Introduction\n\nBefore getting started into the **_kink_**, we should talk about a bit [KinD](https://kind.sigs.k8s.io) first who is not\nfamiliar with this project. **_KinD_** is a tool for running local Kubernetes clusters using Docker container **_\nnodes_**. **_KinD_** was primarily designed for testing Kubernetes itself, but may be used for local development or CI.\n\nSo, what is **_kink_** then, where does this idea come from?\n\n**_kink_** is a CLI application that facilitates to run KinD cluster in Kubernetes Pod and also manages the whole\nlifecycle of these clusters such as by listing them, deleting them, etc. There is a very detailed guide about how you\ncan run KinD cluster in a Pod, for more detail,\nplease [see](https://d2iq.com/blog/running-kind-inside-a-kubernetes-cluster-for-continuous-integration) because this is\nwhere the idea came from.\n\nThe idea is that when you want to run ephemeral clusters by using projects like KinD in your CI/CD system instead of\nhaving Kubernetes clusters, because it might cost more, you might want to run your KinD cluster in a Pod, especially if\nyou are using Gitlab as a CI/CD solution and running your jobs as Kubernetes Pod. This project specifically aims to\nsolve that problem. By using **_kink_**, you can easily manage whole lifecycle of your KinD cluster no matter how many\nthey are as Kubernetes Pod.\n\n## How it works ?\n\n### Architectural Diagram\n\n![kink_v1](./assets/kink_v1.png)\n\n**_kink_** is a just a wrapper around managing Docker images which are purposely built to run **_KinD_** on Kubernetes\nclusters inside a Pod. As I mentioned above, there is very detailed guide that explains all the necessary details to\nrun **_Kind_** on Kubernetes clusters inside Pod. So, there are some Docker images which we maintained\nit [here](https://gitlab.trendyol.com/platform/base/poc/running-kind-cluster-in-pod-images). In this repository, we are\nproviding Docker images for different version\nof [Docker](https://gitlab.trendyol.com/platform/base/poc/running-kind-cluster-in-pod-images/-/blob/master/dind/Dockerfile.buster#L3)\nand [Kubernetes](https://gitlab.trendyol.com/platform/base/poc/running-kind-cluster-in-pod-images/-/blob/master/kind-cluster/node/Dockerfile#L1)\n. Then, **_kink_** allows you to create Kubernetes Pods based on Docker images we provide and connect to the cluster\nrunning inside a Pod. In order the connect to the cluster running inside a Pod, **_kink_** does some tricks such as\ncreating **_Kubernetes Service_**\nand [adding node IP](https://github.com/Trendyol/kink/-/blob/master/cmd/run.go#L145-152) which is scheduled on to\nthe [CERT_SANS](https://gitlab.trendyol.com/platform/base/poc/running-kind-cluster-in-pod-images/-/blob/master/kind-cluster/entrypoint-wrapper.sh#L17)\naddresses to make the connection secure over HTTPS.\n\n\u003e **_kink_** uses labels to follow the user activities because we have to provide multi-tenancy support for our users in order to avoid stepping each other toes in same Kubernetes environment,\n\u003e you can see the label which we are currently using to achieve uniqueness.\n\u003e https://github.com/Trendyol/kink/-/blob/master/cmd/run.go#L91\n\n## Installation\n\n### Go\n\nIf you have Go 1.16+, you can directly install by running:\n\n```shell\n$ go install github.com/Trendyol/kink@latest\n```\n\nand the resulting binary will be placed at **_$HOME/go/bin/kink_**.\n\n### Homebrew\n\nIf you have brew installed, then you can easily download this with the following commands:\n\n```shell\nbrew tap trendyol/trendyol-tap\nbrew install kink\n```\n\n## Quick Start\n\n```shell\n$ kink --help\nA helper CLI that facilitates to manage KinD clusters as Kubernetes pods\n\nUsage:\n  kink [command]\n\nAvailable Commands:\n  completion              Generate completion script\n  delete                  Ephemeral cluster could be deleted by delete command\n  help                    Help about any command\n  list                    List all ephemeral cluster\n  list-supported-versions List all supported k8s versions\n  run                     Ephemeral cluster could be created by run command\n```\n\nThis shows how to:\n\n* list supported Kubernetes versions\n* pick one of these versions and run KinD cluster\n* list KinD clusters\n* delete KinD clusters\n\n### List supported Kubernetes versions\n\n```shell\n$ kink list-supported-versions\nv1.16.15\nv1.17.17\nv1.19.11\nv1.20.7\nv1.21.2\n```\n\n### Run KinD cluster\n\n* Choose one of your favorite Kubernetes distribution such as KinD, Minikube, k0s, k3s, etc and run it first.\n\nCreate custer with **_kind_**\n\n```shell\n$ kind create cluster\n```\n\nRun **_kink_**\n```shell\n$ kink run hello-world --timeout 360\n[1/1] Creating Pod hello-world... 100% [===============] (0.001 kB/s)KUBECONFIG file has been written to\nthe directory: /var/folders/pf/6h9t0mnd4d342ncgpjq_3zl80000gp/T/kink_kubeconfig3638074110/kubeconfig\nThanks for using kink!\nPod hello-world and Service hello-world created successfully!\n\nYou can view the logs by running the following command:\n$ kubectl logs -f hello-world -n default\n\nKUBECONFIG file generated at path '/Users/batuhan.apaydin/workspace/projects/trendyol/k8s-common/kubeconfig'.\nStart managing your internal KinD cluster by running the following command:\n$ KUBECONFIG=/Users/batuhan.apaydin/workspace/projects/trendyol/k8s-common/kubeconfig kubectl get nodes -o wide\n```\n\n### List KinD clusters\n\n* You can list all the KinD cluster provisied by yourself:\n\n```shell\n$ kink list\nNAMESPACE   NAME              AGE    LABELS\ndefault     pod/hello-world   5m5s   generated-uuid=99596236-4b08-4e09-82ec-db3158840a1c,runned-by=batuhan.apaydin_C02DM1U3MD6R\n```\n\n### Delete KinD clusters\n\n* You can delete all the KinD clusters that you provisioned:\n\n```shell\n$ kink delete --all --force\nDeleting Pod hello-world\nDeleting Service hello-world\n\n```\n\n* or you can delete one of them by speficying its name in the **_-name_** flag.\n\n\n## Autocompletion Support\n\nTo load completions:\n\n### Bash\n\n```shell\n$ source \u003c(kink completion bash)\n\n# To load completions for each session, execute once:\n# Linux:\n$ kink completion bash \u003e /etc/bash_completion.d/kink\n# macOS:\n$ kink completion bash \u003e /usr/local/etc/bash_completion.d/kink\n```\n\n### Zsh\n\n```shell\n# If shell completion is not already enabled in your environment,\n# you will need to enable it.  You can execute the following once:\n\n$ echo \"autoload -U compinit; compinit\" \u003e\u003e ~/.zshrc\n\n# To load completions for each session, execute once:\n$ kink completion zsh \u003e \"${fpath[1]}/_kink\"\n\n# You will need to start a new shell for this setup to take effect.\n```\n\n### fish\n\n```shell\n$ kink completion fish | source\n\n# To load completions for each session, execute once:\n$ kink completion fish \u003e ~/.config/fish/completions/kink.fish\n```\n\n### PowerShell\n\n```shell\nPS\u003e kink completion powershell | Out-String | Invoke-Expression\n\n# To load completions for every new session, run:\nPS\u003e kink completion powershell \u003e kink.ps1\n# and source this file from your PowerShell profile.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrendyol%2Fkink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTrendyol%2Fkink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTrendyol%2Fkink/lists"}