|
1 |
| -## The following are Podman specific steps used to set up on a MacBook (Intel or Apple Silicon) |
| 1 | +# Configuring Podman for Tilt |
2 | 2 |
|
3 |
| -### Verify installed tools (install if needed) |
| 3 | +The following tutorial explains how to set up a local development environment using Podman and Tilt on a Linux host. |
| 4 | +A few notes on achieving the same result for MacOS are included at the end, but you will likely need to do some |
| 5 | +tinkering on your own. |
| 6 | + |
| 7 | +## Verify installed tools (install if needed) |
| 8 | + |
| 9 | +Ensure you have installed [Podman](https://podman.io/), [Kind](https://github.com/kubernetes-sigs/kind/), and [Tilt](https://tilt.dev/). |
4 | 10 |
|
5 | 11 | ```sh
|
6 | 12 | $ podman --version
|
7 | 13 | podman version 5.0.1
|
8 | 14 | $ kind version
|
9 |
| -kind v0.23.0 go1.22.3 darwin/arm64 |
10 |
| - |
11 |
| -(optional) |
| 15 | +kind v0.26.0 go1.23.4 linux/amd64 |
12 | 16 | $ tilt version
|
13 |
| -v0.33.12, built 2024-03-28 |
| 17 | +v0.33.15, built 2024-05-31 |
14 | 18 | ```
|
15 | 19 |
|
16 |
| -### Start Kind with a local registry |
17 |
| -Use this [helper script](./kind-with-registry-podman.sh) to create a local single-node Kind cluster with an attached local image registry. |
| 20 | +## Start Kind with a local registry |
18 | 21 |
|
19 |
| -#### Disable secure access on the local kind registry: |
| 22 | +Use this [helper script](./kind-with-registry-podman.sh) to create a local single-node Kind cluster with an attached local image registry. |
20 | 23 |
|
21 |
| -`podman inspect kind-registry --format '{{.NetworkSettings.Ports}}'` |
22 | 24 |
|
23 |
| -With the port you find for 127.0.0.1 edit the Podman machine's config file: |
| 25 | +## Disable secure access on the local kind registry: |
24 | 26 |
|
25 |
| -`podman machine ssh` |
| 27 | +Verify the port used by the image registry: |
26 | 28 |
|
27 |
| -`sudo vi /etc/containers/registries.conf.d/100-kind.conf` |
| 29 | +```sh |
| 30 | +podman inspect kind-registry --format '{{.NetworkSettings.Ports}}' |
| 31 | +``` |
28 | 32 |
|
29 |
| -Should look like: |
| 33 | +Edit `/etc/containers/registries.conf.d/100-kind.conf` so it contains the following, substituting 5001 if your registry is using a different port: |
30 | 34 |
|
31 | 35 | ```ini
|
32 | 36 | [[registry]]
|
33 | 37 | location = "localhost:5001"
|
34 | 38 | insecure = true
|
35 | 39 | ```
|
36 | 40 |
|
37 |
| -### export DOCKER_HOST |
| 41 | +## Configure the Podman socket |
38 | 42 |
|
39 |
| -`export DOCKER_HOST=unix:///var/run/docker.sock` |
| 43 | +Tilt needs to connect to the Podman socket to initiate image builds. The socket address can differ |
| 44 | +depending on your host OS and whether you want to use rootful or rootless Podman. If you're not sure, |
| 45 | +you should use rootless. |
40 | 46 |
|
| 47 | +You can start the rootless Podman socket by running `podman --user start podman.socket`. |
| 48 | +If you would like to automatically start the socket in your user session, you can run |
| 49 | +`systemctl --user enable --now podman.socket`. |
41 | 50 |
|
42 |
| -### Optional - Start tilt with the tilt file in the parent directory |
| 51 | +Find the location of your user socket with `systemctl --user status podman.socket`: |
43 | 52 |
|
44 |
| -`DOCKER_BUILDKIT=0 tilt up` |
| 53 | +```sh |
| 54 | +● podman.socket - Podman API Socket |
| 55 | + Loaded: loaded (/usr/lib/systemd/user/podman.socket; enabled; preset: disabled) |
| 56 | + Active: active (listening) since Tue 2025-01-28 11:40:50 CST; 7s ago |
| 57 | + Invocation: d9604e587f2a4581bc79cbe4efe9c7e7 |
| 58 | + Triggers: ● podman.service |
| 59 | + Docs: man:podman-system-service(1) |
| 60 | + Listen: /run/user/1000/podman/podman.sock (Stream) |
| 61 | + CGroup: /user.slice/user-1000.slice/ [email protected]/app.slice/podman.socket |
| 62 | +``` |
45 | 63 |
|
46 |
| -### Optional troubleshooting |
| 64 | +The location of the socket is shown in the `Listen` section, which in the example above |
| 65 | +is `/run/user/1000/podman/podman.sock`. |
47 | 66 |
|
48 |
| -In some cases it may be needed to do |
| 67 | +Set `DOCKER_HOST` to a unix address at the socket location: |
| 68 | + |
| 69 | +```sh |
| 70 | +export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock |
49 | 71 | ```
|
50 |
| -sudo podman-mac-helper install |
| 72 | + |
| 73 | +Some systems might symlink the Podman socket to a docker socket, in which case |
| 74 | +you might need to try something like: |
| 75 | + |
| 76 | +```sh |
| 77 | +export DOCKER_HOST=unix:///var/run/docker.sock |
51 | 78 | ```
|
| 79 | + |
| 80 | +## Start Tilt |
| 81 | + |
| 82 | +Running Tilt with a container engine other than Docker requires setting `DOCKER_BUILDKIT=0`. |
| 83 | +You can export this, or just run: |
| 84 | + |
| 85 | +```sh |
| 86 | +DOCKER_BUILDKIT=0 tilt up |
52 | 87 | ```
|
| 88 | + |
| 89 | +## MacOS Troubleshooting |
| 90 | + |
| 91 | +The instructions above are written for use on a Linux system. You should be able to create |
| 92 | +the same or a similar configuration on MacOS, but specific steps will differ. |
| 93 | + |
| 94 | +In some cases you might need to run: |
| 95 | + |
| 96 | +```sh |
| 97 | +sudo podman-mac-helper install |
| 98 | + |
53 | 99 | podman machine stop/start
|
54 | 100 | ```
|
| 101 | + |
| 102 | +When disabling secure access to the registry, you will need to first enter the Podman virtual machine: |
| 103 | +`podman machine ssh` |
0 commit comments