veilletechno:atomic

Ceci est une ancienne révision du document !


Atomic CentOS 7

Création d'un containeur docker registry :

sudo docker create -p 5000:5000
-v /var/lib/local-registry:/var/lib/registry
-e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry
-e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io
--name=local-registry registry:2

Gérer les contextes SELinux sur le stockage des images du registry :

sudo mkdir -p /var/lib/local-registry
sudo chcon -Rvt svirt_sandbox_file_t /var/lib/local-registry

Création d'un service pour démarrer automatiquement le registry. Contenu du fichier /etc/systemd/system/local-registry.service :

[Unit]
Description=Local Docker Mirror registry cache
Requires=docker.service
After=docker.service

[Service]
Restart=on-failure
RestartSec=10
ExecStart=/usr/bin/docker start -a %p
ExecStop=-/usr/bin/docker stop -t 2 %p

[Install]
WantedBy=multi-user.target

Pour l'activer :

sudo systemctl daemon-reload

sudo systemctl enable local-registry

sudo systemctl start local-registry

Ajout du docker registry normalement hébergé sur le master. Dans /etc/sysconfig/docker dans OPTIONS ajouter :

–registry-mirror=http://192.168.2.112:5000

Il faut principalement indiquer le cluster ETCD et le chemin pour accéder à la configuration du réseau. Fichier /etc/sysconfig/flanneld :

# etcd url location. Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://192.168.2.112:2379"

# etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network"

Il s'agit de configurer la partie cliente : kubelet. Principalement d'indiquer le hostname (hostname -f doit correspondre) et l'adresse du client, ainsi que celle du master.

###
# kubernetes kubelet (minion) config

# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=192.168.2.108"

# The port for the info server to serve on
# KUBELET_PORT="--port=10250"

# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=atomic7-1.localdomain"

# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.2.112:8080"

# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"

# Add your own!
KUBELET_ARGS=""

Il faut aussi préciser comment joindre le cluster ETCD, via le fichier /etc/kubernetes/config :

###
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
#   kube-apiserver.service
#   kube-controller-manager.service
#   kube-scheduler.service
#   kubelet.service
#   kube-proxy.service
# logging to stderr means we get it in the systemd journal
KUBE_LOGTOSTDERR="--logtostderr=true"

# journal message level, 0 is debug
KUBE_LOG_LEVEL="--v=0"

# Should this cluster be allowed to run privileged docker containers
KUBE_ALLOW_PRIV="--allow-privileged=false"

# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.2.112:8080"

Il ne reste plus qu'à activer les services, et à redemarrer pour être sûr de rien avoir oublié :

sudo systemctl enable flanneld kubelet kube-proxy
sudo systemctl reboot
  • veilletechno/atomic.1500801528.txt.gz
  • Dernière modification : 2017/07/23 09:18
  • de madko