Run this notebook

Use Livebook to open this notebook and explore new ideas.

It is easy to get started, on your machine or the cloud.

Click below to open and run it in your Livebook at .

(or change your Livebook location)

# ⚠️ ARCHIVED ⚠️ KinoK8sTerm > [!IMPORTANT] > This repository is archived. The smart cell is now integrated in the > "Connect to Pod" smart cell of [kino_k8s](https://github.com/mruoss/kino_k8s). > Check it out! A Livebook Kino to run a Terminal for Kubernetes Pods. ## Section [![Run in Livebook](https://livebook.dev/badge/v1/pink.svg)](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fmruoss%2Fkino_k8s_term%2Fblob%2Fmain%2FREADME.livemd) ## About This Kino uses the Elixir library [k8s](https://github.com/coryodaniel/k8s) to open a connection to a pod and [Xterm.js](http://xtermjs.org/) to render a terminal in your livebook. Refer to these projects for inside information. https://user-images.githubusercontent.com/695307/208457804-614b5a82-9108-4281-b711-df8ac4040be3.mp4 ## Installation This Kino is currently not published on hex.pm. To use it, install it from git: ```elixir Mix.install([ {:kino_k8s_term, git: "https://github.com/mruoss/kino_k8s_term.git", branch: "main"} ]) ``` ## Usage You can either use the Smart Cell or call `KinoK8sTerm.open/4` manually. ### Arguments - `conn` - a `%K8s.Conn{}` struct that can be optained by calling `K8s.Conn.from_file/2` - `namespace` - The namespace your pod runs in - `pod` - The name of your pod ### Options - `container` - If your pod runs multiple containers, define the container you want to connect to. - `command` - optional. The shell that is executed once connected. Defaults to `/bin/sh`. ```elixir {:ok, conn} = K8s.Conn.from_file("~/.kube/config", context: "some_local_cluster") # For local clusters, you might want to skip TLS verification conn = struct!(conn, insecure_skip_tls_verify: true) namespace = "default" pod = "nginx-deployment-6595874d85-5kdf4" container = "nginx" command = "/bin/bash" KinoK8sTerm.open(conn, namespace, pod, container: container, command: command) ``` ## Smart Cell This Kino comes with a smart cell, too. [Open this README in Livebook](https://livebook.dev/run?url=https%3A%2F%2Fgithub.com%2Fmruoss%2Fkino_k8s_term%2Fblob%2Fmain%2FREADME.livemd) to see it in action. <!-- livebook:{"attrs":{},"chunks":null,"kind":"Elixir.KinoK8sTerm.SmartCell","livebook_object":"smart_cell"} --> ```elixir IO.puts("Connection could not be established. Please configure the connection to the pod and reevaluate the cell.") :no_conn ``` ## Security Note that the user defined in the `conn` object needs permissions to the `pods/exec` resource in your cluster. If this is not given, the terminal can't be opened. Use this Kino for local clusters only. Or protect your livebook well from unwanted access.
See source

Have you already installed Livebook?

If you already installed Livebook, you can configure the default Livebook location where you want to open notebooks.
Livebook up Checking status We can't reach this Livebook (but we saved your preference anyway)
Run notebook

Not yet? Install Livebook in just a minute

Livebook is open source, free, and ready to run anywhere.

Run on your machine

with Livebook Desktop

Run in the cloud

on select platforms

To run on Linux, Docker, embedded devices, or Elixir’s Mix, check our README.

PLATINUM SPONSORS
SPONSORS
Code navigation with go to definition of modules and functions Read More ×