Mirantis / virtlet

Kubernetes CRI implementation for running VM workloads
Apache License 2.0
743 stars 128 forks source link

IP changed after reboot #892

Closed haosdent closed 5 years ago

haosdent commented 5 years ago

I use Calico CNI with virtlet, however, after I reboot the server, the IP of the server changed. How to avoid this?

pigmej commented 5 years ago

Hey, that’s how it works with kubernetes. Docker/containerd pods also may have different ip after reboot.

What do you need static ip for? You can use normal k8s services to access services on the vm.

haosdent commented 5 years ago

Oh, because I would like to keep IP when ssh

haosdent commented 5 years ago

Currently I use cni.projectcalico.org/ipAddrs to fix it, maybe we could record this and keep ip.

pigmej commented 5 years ago

@haosdent For your safety, you should NOT rely on fixed IP address. In k8s if you need such thingy, you should use services for that behavior. So in your situation just use service for SSH. If you need external access then the desired way is to use LoadBalancer service type. They all will work with Virtlet flawlessly.

cni.projectcalico.org/ipAddrs is obviously a way of solving it if really needed as Virtlet uses CNI :)

haosdent commented 5 years ago

use services for that behavior.

I see, thx @pigmej