UTS Namespace
Podstawowe informacje
Namespace UTS (UNIX Time-Sharing System) to funkcja jądra Linux, która zapewnia izolację dwóch identyfikatorów systemowych: nazwy hosta i nazwy domeny NIS (Network Information Service). Ta izolacja pozwala każdemu namespace UTS mieć własną niezależną nazwę hosta i nazwę domeny NIS, co jest szczególnie przydatne w scenariuszach konteneryzacji, gdzie każdy kontener powinien wyglądać jak oddzielny system z własną nazwą hosta.
Jak to działa:
Gdy nowy namespace UTS jest tworzony, zaczyna od kopii nazwy hosta i nazwy domeny NIS z jego rodzicielskiego namespace. Oznacza to, że w momencie utworzenia nowy namespace dzieli te same identyfikatory co jego rodzic. Jednak wszelkie późniejsze zmiany w nazwie hosta lub nazwie domeny NIS w obrębie namespace nie wpłyną na inne namespace.
Procesy w obrębie namespace UTS mogą zmieniać nazwę hosta i nazwę domeny NIS za pomocą wywołań systemowych
sethostname()
isetdomainname()
, odpowiednio. Te zmiany są lokalne dla namespace i nie wpływają na inne namespace ani na system gospodarza.Procesy mogą przemieszczać się między namespace za pomocą wywołania systemowego
setns()
lub tworzyć nowe namespace za pomocą wywołań systemowychunshare()
lubclone()
z flagąCLONE_NEWUTS
. Gdy proces przemieszcza się do nowego namespace lub go tworzy, zacznie używać nazwy hosta i nazwy domeny NIS związanej z tym namespace.
Laboratorium:
Tworzenie różnych Namespace
CLI
By mounting a new instance of the /proc
filesystem if you use the param --mount-proc
, you ensure that the new mount namespace has an dokładny i izolowany widok informacji o procesach specyficznych dla tej przestrzeni nazw.
Docker
Sprawdź, w jakiej przestrzeni nazw znajduje się twój proces
Znajdź wszystkie przestrzenie nazw UTS
Wejście do przestrzeni nazw UTS
Last updated