Skip to content

Commit

Permalink
Merge pull request #131 from oomichi/add-more-podman
Browse files Browse the repository at this point in the history
Add communication between pods
  • Loading branch information
oomichi authored Nov 3, 2023
2 parents d2facd9 + 7c56d71 commit 13403b4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
52 changes: 50 additions & 2 deletions podman/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ $ podman play kube ./test-svc.yaml
```
NOTE: Necessary to specify dockerhub registry cleary with `registry.hub.docker.com/library/` for nginx image.

Know avaiable options
Know available options
---------------------

`podman pod` seems like `kubectl` for pod operation and the avaiable options are:
`podman pod` seems like `kubectl` for pod operation and the available options are:

```
$ podman pod --help
Expand Down Expand Up @@ -112,3 +112,51 @@ Commercial support is available at
</body>
</html>
root@test-svc:/#
```

Network communication between pods
----------------------------------

Need to specify the same network when deploying pods:
```
$ podman play kube --network podman ./shell.yaml
$ podman play kube --network podman ./pods-and-svc.yaml
```
Check IP address of nginx pod:
```
$ podman ps | grep nginx
4675e132974a registry.hub.docker.com/library/nginx:latest nginx -g daemon o... 39 minutes ago Up 39 minutes ago test-svc-nginx
$ podman inspect test-svc-nginx | jq -r ".[0].NetworkSettings.Networks.podman.IPAddress"
10.88.0.3
$
```
Access to nginx from a different container:
```
$ podman ps | grep bash
3c1758a60d3b docker.io/library/ubuntu:22.04 41 minutes ago Up 41 minutes ago test-shell-bash
$
$ podman exec -it 3c1758a60d3b curl 10.88.0.3
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
```
9 changes: 9 additions & 0 deletions podman/shell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Pod
metadata:
name: test-shell
spec:
containers:
- name: bash
image: ubuntu:22.04
command: ["sleep", "3600"]

0 comments on commit 13403b4

Please sign in to comment.