Dashboard Kubernetes sur Openshift

Openshift en local, Minishift, peut être enrichi avec quelques plugins. Je vous propose de les ajouter. Le plus intéressant est pour moi la console de supervision transverse: le dashboard Kubernetes.

Installation des addons par défaut

  1. anyuid: Les projets auront les droits d’exécution anyuid par défaut.
  2. xpaas: Les templates de RedHat sont installés.
  3. admin-user: L’administrateur du cluster est défini.
minishift addons install --defaults
Default add-ons anyuid, admin-user, xpaas installed

minishift addons list --verbose=true
Name : admin-user
Description: Create admin user and assign the cluster-admin role to it.
Enabled : disabled
Priority : 0

Name : anyuid
Description: Changes the default security context constraints to allow pods to run as any user.
Enabled : disabled
Priority : 0

Name : xpaas
Description: Imports xPaaS templates
Enabled : disabled
Priority : 0

minishift addons enable anyuid
Add-on 'anyuid' enabled

minishift addons enable xpaas
Add-on 'xpaas' enabled

minishift addons enable admin-user
Add-on 'admin-user' enabled

Installation des addons complémentaires de Jorge Moralespou

Jorge propose quelques addons sympathiques sur GitHub dont la console Kubernetes. Elle va nous permettre de suivre les ressources matérielles de manière transverse, en plus de celle de OpenShift.

cd jorgemoralespou\minishift-addons

minishift addons install kube-dashboard
Addon 'kube-dashboard' installed

minishift addons list --verbose=true
Name : admin-user
Description: Create admin user and assign the cluster-admin role to it.
Enabled : enabled
Priority : 0

Name : anyuid
Description: Changes the default security context constraints to allow pods to run as any user.
Enabled : enabled
Priority : 0

Name : xpaas
Description: Imports xPaaS templates
Enabled : enabled
Priority : 0

Name : kube-dashboard
Description: Deploys the kubernetes dashboard
Enabled : disabled
Priority : 0

minishift addons enable kube-dashboard
Add-on 'kube-dashboard' enabled

Suppression de minishift et rédémarrage

minishift stop
Stopping local OpenShift cluster...
Cluster stopped.

minishift delete
Deleting the Minishift VM...
Minishift VM deleted.

minishift start --show-libmachine-logs --metrics -v 2 --cpus 4 --disk-size "80g" --memory 10240 --routing-suffix minishift.local --public-hostname minishift --vm-driver virtualbox
Starting local OpenShift cluster using 'virtualbox' hypervisor...
(minishift) Trying to access option engine-install-url which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
Running pre-create checks...
(minishift) Type assertion did not go smoothly to string for key engine-install-url
(minishift) Trying to access option swarm-master which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to bool for key swarm-master
(minishift) Trying to access option swarm-host which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-host
(minishift) Trying to access option swarm-discovery which does not exist
(minishift) THIS ***WILL*** CAUSE UNEXPECTED BEHAVIOR
(minishift) Type assertion did not go smoothly to string for key swarm-discovery
(minishift) Type assertion did not go smoothly to bool for key virtualbox-host-dns-resolver
(minishift) Type assertion did not go smoothly to bool for key virtualbox-hostonly-no-dhcp
(minishift) Type assertion did not go smoothly to bool for key virtualbox-no-share
(minishift) Type assertion did not go smoothly to bool for key virtualbox-no-dns-proxy
(minishift) Type assertion did not go smoothly to bool for key virtualbox-no-vtx-check
Creating machine...
(minishift) Downloading C:\Users\emman\.minishift\cache\boot2docker.iso from file://C:/Users/emman/.minishift/cache/iso/minishift-b2d.iso...
(minishift) Creating VirtualBox VM...
(minishift) Creating SSH key...
(minishift) Starting the VM...
(minishift) Check network to re-create if needed...
(minishift) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
-- Checking OpenShift client ... OK
-- Checking Docker client ... OK
-- Checking Docker version ... OK
-- Checking for existing OpenShift container ... OK
-- Checking for openshift/origin:v1.5.1 image ...
Pulling image openshift/origin:v1.5.1
Pulled 0/3 layers, 3% complete
Pulled 1/3 layers, 55% complete
Pulled 2/3 layers, 94% complete
Pulled 3/3 layers, 100% complete
Extracting
Image pull complete
-- Checking Docker daemon configuration ... OK
-- Checking for available ports ... OK
-- Checking type of volume mount ...
Using Docker shared volumes for OpenShift volumes
-- Creating host directories ... OK
-- Finding server IP ...
Using 192.168.99.101 as the server IP
-- Starting OpenShift container ...
Creating initial OpenShift configuration
Starting OpenShift using container 'origin'
Waiting for API server to start listening
OpenShift server started
-- Adding default OAuthClient redirect URIs ... OK
-- Installing registry ... OK
-- Installing router ... OK
-- Installing metrics ... OK
-- Importing image streams ... OK
-- Importing templates ... OK
-- Login to server ... OK
-- Creating initial project "myproject" ... OK
-- Removing temporary directory ... OK
-- Checking container networking ... OK
-- Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://minishift:8443

The metrics service is available at:
https://metrics-openshift-infra.minishift.local

You are logged in as:
User: developer
Password: developer

To login as administrator:
oc login -u system:admin

-- Waiting for persistent volumes to be created ... OK

-- Applying addon 'admin-user':..

-- Applying addon 'anyuid':.
Add-on 'anyuid' changed the default security context constraints to allow pods to run as any user.
Per default OpenShift runs containers using an arbitrarily assigned user ID.
Refer to https://docs.openshift.org/latest/architecture/additional_concepts/authorization.html#security-context-constraints and
https://docs.openshift.org/latest/creating_images/guidelines.html#openshift-origin-specific-guidelines for more information.

-- Applying addon 'kube-dashboard':.........
You have installed kube-dashboard
To access the kube-dashboard go to http://dashboard.minishift.local
or
Use minishift:
minishift openshift service dashboard -n kube-dashboard

To delete:
oc delete project/kube-dashboard --as=system:admin

-- Applying addon 'xpaas':........................................................................................
XPaaS OpenShift imagestream and templates installed
See https://github.com/openshift/openshift-ansible/tree/master/roles/openshift_examples/files/examples/v3.6

Dashboard Kubernetes

La console Kubernetes est maintenant disponible avec Openshift 😀 sur http://dashboard.minishift.local !

Laisser un commentaire