Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace docker with podman #19

Merged
merged 9 commits into from
Sep 1, 2022
Merged

Replace docker with podman #19

merged 9 commits into from
Sep 1, 2022

Conversation

pacostas
Copy link
Member

My status on PR

This commit updates the cloud-native tutorial to use Podman instead of
Docker/Docker Desktop.
@mhdawson mhdawson marked this pull request as ready for review August 31, 2022 20:17
```
We can now build the image directly using `minikube image build`:
```console
$ minikube image build -t $(minikube ip):42631/nodeserver:1.0.0 --file Dockerfile-run .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This did not work for me in a Windows cmd shell.

I had to do the following which did work:
C:\Users\midawson\workshop\tutorial\nodeserver>minikube ip
172.26.219.253

C:\Users\midawson\workshop\tutorial\nodeserver> minikube image build -t 172.26.219.253:42631/nodeserver:1.0.0 --file Dockerfile-run .

It also took quite a while to run without output so might be worth mentioning that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll investigate tomorrow a bit more. Also I'll check if we can do pull/push etc. using the podman Desktop registry UI.

```
Next, we push the image into the registry using:
```console
$ minikube image push $(minikube ip):42631/nodeserver
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the IP isntead of $(minikube ip) here as well

@@ -448,7 +445,7 @@ Kubernetes has a concept of a 'Service', which is an abstract way to expose an a
3. You can forward the `nodeserver-service` to your device by:

```sh
kubectl port-forward service/nodeserver-service 3000
minikube kubectl -- port-forward service/nodeserver-service 3000
```

You can now access the application endpoints from your browser.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be handy to add the links to the app, metrics and health endpoints again here, just like in the other sections.

export POD_NAME=$(kubectl get pods --namespace grafana -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace grafana port-forward $POD_NAME 3001:3000
export POD_NAME=$(minikube kubectl -- get pods --namespace grafana -o jsonpath="{.items[0].metadata.name}")
minikube kubectl -- --namespace grafana port-forward $POD_NAME 3001:3000
Copy link
Contributor

@mhdawson mhdawson Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the On Windows section the corresponding change is missing.
minikube needs to be added in front of kubectl in both lines

minikube needs to be changed to minikube kubectl --

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same is true right at the end where is says kubectl config set-context --current --namespace=default kubectl needs to be changed to minikube kubectl --

Comment on lines 83 to 78
Install docker compose
1. Select the Docker icon in the Menu Bar
2. Click `Preferences/Settings > Kubernetes > Enable Kubernetes`.
Copy link
Contributor

@mhdawson mhdawson Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not refer to docker anymore right?
should likely be

podman machine init --cpus 4 --memory 8096 --disk-size 50
podman machine start
podman system connection default podman-machine-default-root
minikube start --driver=podman --container-runtime=cri-o

(with podman machine stop, podman machine rm first if the machine is already created

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found other instructions which said

podman machine init --cpus 2 --memory 2048 --disk-size 20
podman machine start
podman system connection default podman-machine-default-root
podman info

so using less memory/cpus may make sense, I used the larger numbers but we should try the smaller ones.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the mac flow.

Comment on lines 82 to 90
Using [Chocolatey](https://docs.chocolatey.org/en-us/choco/setup#install-with-powershell.exe) Package Manager

#### `microk8s`
1. Install minikube with Chocolatey Package manager by using this command in PowerShell

<details>
```
choco install minikube
```

```sh
snap install --channel 1.14/stable microk8s --classic
sudo usermod -a -G microk8s ibmuser
sudo microk8s.start
sudo snap alias microk8s.kubectl kubectl
export PATH=/snap/bin:$PATH
sudo microk8s.config >~/.kube/config
microk8s.enable dns registry
```
2. Start minikube
Copy link
Contributor

@mhdawson mhdawson Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Using [Chocolatey](https://docs.chocolatey.org/en-us/choco/setup#install-with-powershell.exe) Package Manager
#### `microk8s`
1. Install minikube with Chocolatey Package manager by using this command in PowerShell
<details>
```
choco install minikube
```
```sh
snap install --channel 1.14/stable microk8s --classic
sudo usermod -a -G microk8s ibmuser
sudo microk8s.start
sudo snap alias microk8s.kubectl kubectl
export PATH=/snap/bin:$PATH
sudo microk8s.config >~/.kube/config
microk8s.enable dns registry
```
2. Start minikube
1. Start minikube

I think minikube installation is covered in other sections.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have it as a prerequisite at the start of the document, we dont cover the installation process. In case of adding it, should we go with the binary/PATH method or with a package manager? The only drawback I see with the binary/PATH method is that the developers are not that much familiar otherwise in terms of time and steps its the same.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit reference 637936c

cloud-native/README.md Outdated Show resolved Hide resolved
@mhdawson
Copy link
Contributor

mhdawson commented Aug 31, 2022

Had a few specific comments but overall on Windows seemed to flow ok.

Three things we should think about for follow on PRs

  1. can we easily alias minikube kubectl -- to kubectl on all platforms. If so we may want to do that to make most of the instructions more kubernetes generic.
  2. Should we add a registry to podman instead of using $ minikube image push $(minikube ip):42631/nodeserver, again that might be more kubenetes generic.
  3. If 1 and 2) work out then I wonder if we could have 2 options. 1 to install minikube and 1 to use the RH sandbox. If the rest of the instructions just used kubectl then there might not be any other differences in the instructions other than how you set up kubectl (aliast for minikube or alias to oc for sandbox) and the registry set up for podman (registry in minikube or your registry in sandbox)

@mhdawson
Copy link
Contributor

One other thing is that at least on windows it does require admin access to install the pieces needed (podman which requires both hyperv and wsl). I think we better try to get a message to participants in advance with the warning that admin access is needed, and that they should if at all possible install X,Y,Z in advance depending on the platform

@mhdawson
Copy link
Contributor

mhdawson commented Aug 31, 2022

One more, do we even need podman desktop? I don't think we use or mention it in the workshop (although we might want to change that). I wondered about that as the installation instructions don't include the link for Mac, although it is available.

@pacostas pacostas force-pushed the podman branch 2 times, most recently from 3bcc08d to 637936c Compare September 1, 2022 15:21
@@ -337,6 +338,52 @@ You have now built a container image for your application called `nodeserver` wi

This runs your container image in a Podman container, mapping port 3000 from the container to port 3000 on your laptop so that you can access the application.

#### On Windows
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had locally and forgot to push:

  • Instructions for windows users with images for using podman desktop for building and running container images.

@mhdawson mhdawson merged commit 790f22b into nodeshift:main Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants