{"id":13507574,"url":"https://github.com/coryodaniel/k8s","last_synced_at":"2025-05-14T13:02:30.569Z","repository":{"id":39989615,"uuid":"165217643","full_name":"coryodaniel/k8s","owner":"coryodaniel","description":"Kubernetes API Client for Elixir","archived":false,"fork":false,"pushed_at":"2025-03-10T03:44:39.000Z","size":1901,"stargazers_count":324,"open_issues_count":17,"forks_count":47,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-04-11T06:00:06.389Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coryodaniel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["coryodaniel","mruoss"]}},"created_at":"2019-01-11T09:34:31.000Z","updated_at":"2025-03-29T20:23:10.000Z","dependencies_parsed_at":"2023-10-16T17:16:14.001Z","dependency_job_id":"6bdaac82-03c4-4af8-ad39-ce9e71a4261a","html_url":"https://github.com/coryodaniel/k8s","commit_stats":{"total_commits":787,"total_committers":29,"mean_commits":"27.137931034482758","dds":0.6569250317662008,"last_synced_commit":"45a406d1dd7375e9c73932fafce2e96b2b103926"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coryodaniel%2Fk8s","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coryodaniel%2Fk8s/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coryodaniel%2Fk8s/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coryodaniel%2Fk8s/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coryodaniel","download_url":"https://codeload.github.com/coryodaniel/k8s/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254149645,"owners_count":22022846,"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":[],"created_at":"2024-08-01T02:00:36.397Z","updated_at":"2025-05-14T13:02:30.536Z","avatar_url":"https://github.com/coryodaniel.png","language":"Elixir","funding_links":["https://github.com/sponsors/coryodaniel","https://github.com/sponsors/mruoss"],"categories":["Cloud Infrastructure and Management","Elixir"],"sub_categories":[],"readme":"# K8s\n\n[![Module Version](https://img.shields.io/hexpm/v/k8s.svg)](https://hex.pm/packages/k8s)\n[![Coverage Status](https://coveralls.io/repos/github/coryodaniel/k8s/badge.svg?branch=develop)](https://coveralls.io/github/coryodaniel/k8s?branch=develop)\n[![Last Updated](https://img.shields.io/github/last-commit/coryodaniel/k8s.svg)](https://github.com/coryodaniel/k8s/commits/develop)\n\n[![Build Status CI](https://github.com/coryodaniel/k8s/actions/workflows/ci.yaml/badge.svg)](https://github.com/coryodaniel/k8s/actions/workflows/ci.yaml)\n[![Build Status Elixir](https://github.com/coryodaniel/k8s/actions/workflows/elixir_matrix.yaml/badge.svg)](https://github.com/coryodaniel/k8s/actions/workflows/elixir_matrix.yaml)\n[![Build Status K8s](https://github.com/coryodaniel/k8s/actions/workflows/k8s_matrix.yaml/badge.svg)](https://github.com/coryodaniel/k8s/actions/workflows/k8s_matrix.yaml)\n\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/k8s/)\n[![Total Download](https://img.shields.io/hexpm/dt/k8s.svg)](https://hex.pm/packages/k8s)\n[![License](https://img.shields.io/hexpm/l/k8s.svg)](https://github.com/coryodaniel/k8s/blob/develop/LICENSE)\n\n[K8s](https://hexdocs.pm/k8s/usage.html) - Kubernetes API Client for Elixir\n\n## Features\n\n- A client API for humans 👩🏼🧑👩🏻👩🏽👩🏾🧑🏻🧑🏽🧑🧑🏾👨🏼👨🏾👨🏿\n- 🔮 Kubernetes resources, groups, and CRDs are autodiscovered at boot time. No swagger file to include or override.\n- Client supports standard HTTP calls, async batches, wait on status ⏲️, and watchers 👀\n- ⚙️ HTTP Request middleware\n- Multiple clusters ⚓ ⚓ ⚓\n- 🔐 Multiple authentication credentials\n  - 🤖 serviceaccount\n  - token\n  - 📜 certificate\n  - auth-provider\n  - Pluggable auth providers!\n- 🆗 Tested against Kubernetes versions 1.10+ and master\n- 🛠️ CRD support\n- 📈 Integrated with `:telemetry`\n- ℹ️ Kubernetes resource and version helper functions\n- 🧰 Kube config file parsing\n- 🏎️ Macro free; fast compile \u0026 fast startup\n\n## Installation\n\nThe package can be installed by adding `:k8s` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:k8s, \"~\u003e 2.0\"}\n  ]\nend\n```\n\n## Usage\n\nCheck out the [Usage Guide](https://hexdocs.pm/k8s/usage.html) for in-depth examples. If you like\nlearning with Livebook, check out [kino_k8s](https://github.com/mruoss/kino_k8s). It comes with\nnice smart cells to help you generate your first working code.\n\nMost functions are also written using doctests.\n\n- [K8s.Client doctests](https://hexdocs.pm/k8s/K8s.Client.html)\n- [K8s.Conn doctests](https://hexdocs.pm/k8s/K8s.Conn.html)\n- [K8s.Resource doctests](https://hexdocs.pm/k8s/K8s.Resource.html)\n- [K8s.Version doctests](https://hexdocs.pm/k8s/K8s.Version.html)\n\nIf you are interested in building Kubernetes Operators or Schedulers, check out [Bonny](https://github.com/coryodaniel/bonny).\n\n## tl;dr Examples\n\n### Configure a cluster connection\n\nCluster connections can be created using the `K8s.Conn` module.\n\n`K8s.Conn.from_file/1` will use the current context in your kubeconfig.\n\n```elixir\n{:ok, conn} = K8s.Conn.from_file(\"path/to/kubeconfig.yaml\")\n```\n\n`K8s.Conn.from_file/2` accepts a keyword list to set the `:user`, `:cluster`, and/or `:context`\n\nConnections can also be created in-cluster from a service account.\n\n```elixir\n{:ok, conn} = K8s.Conn.from_service_account(\"/path/to/service-account/directory\")\n```\n\nCheck out the [connection guide](https://hexdocs.pm/k8s/connections.html) for additional details.\n\n### Creating a deployment\n\n```elixir\n{:ok, conn} = K8s.Conn.from_file(\"path/to/kubeconfig.yaml\")\n\nopts = [namespace: \"default\", name: \"nginx\", image: \"nginx:nginx:1.7.9\"]\n{:ok, resource} = K8s.Resource.from_file(\"priv/deployment.yaml\", opts)\n\noperation = K8s.Client.create(resource)\n{:ok, deployment} = K8s.Client.run(conn, operation)\n```\n\n### Listing deployments\n\nIn a namespace:\n\n```elixir\n{:ok, conn} = K8s.Conn.from_file(\"path/to/kubeconfig.yaml\")\n\noperation = K8s.Client.list(\"apps/v1\", \"Deployment\", namespace: \"prod\")\n{:ok, deployments} = K8s.Client.run(conn, operation)\n```\n\nAcross all namespaces:\n\n```elixir\n{:ok, conn} = K8s.Conn.from_file(\"path/to/kubeconfig.yaml\")\n\noperation = K8s.Client.list(\"apps/v1\", \"Deployment\", namespace: :all)\n{:ok, deployments} = K8s.Client.run(conn, operation)\n```\n\n### Getting a deployment\n\n```elixir\n{:ok, conn} = K8s.Conn.from_file(\"path/to/kubeconfig.yaml\")\n\noperation = K8s.Client.get(\"apps/v1\", :deployment, [namespace: \"default\", name: \"nginx-deployment\"])\n{:ok, deployment} = K8s.Client.run(conn, operation)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoryodaniel%2Fk8s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoryodaniel%2Fk8s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoryodaniel%2Fk8s/lists"}