Author Photo

Being a Linux Enthusiast and a Fan of Open Source Software, I created Ahmer’s SysAdmin Recipes blog to share my experiences with other System Administrators. The curiosity doesn’t let me stop; therefore, I am constantly trying to learn new software tools and techniques. Whereas I also have the passion and the patience to teach the others.

I am always ready to accept new challenges and wish to explore the areas, that I haven’t worked on. Please give me your feedback and help me improve this blog.

Saturday, 25 May 2019

Install Cockpit Web UI on CentOS 7

Install Cockpit Web UI on CentOS 7Cockpit is a Red Hat sponsored free and open-source software project. Cockpit is a Web UI (User Interface) that facilitates management and monitoring of a Linux server through a web browser. Besides regular operating system related management tasks, it also provides support for Docker, Kubernetes and KVM.  It is very easy to start containers, administer storage, configure networks, and inspect logs via Cockpit Web UI.

In this article, we will install Cockpit Web UI on CentOS 7 server and then add support in Cockpit for managing our Kubernetes cluster, Docker and Storage.

 

System Specification:

We have a CentOS 7 virtual machine with following specifications.

Hostname: kubemaster-01.example.com
IP Address: 192.168.116.160/24
Operating System: CentOS 7.6

The above server is the master node of a Kubernetes cluster. For information about Kubernetes configuration please refer to our previous article Install Kubernetes Cluster with Docker CE on CentOS 7. To read more about Kubernetes you should read Kubernetes in Action by Marko Luksa.

 

Installing Cockpit Web UI on CentOS 7:

Connect with kubemaster-01.example.com using ssh as root user.

Cockpit is available through EPEL (Extra Packages for Enterprise Linux) yum repository. Therefore, we have to install epel-release first.

[root@kubemaster-01 ~]# yum install -y epel-release Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.ges.net.pk * extras: mirrors.ges.net.pk * updates: mirrors.ges.net.pk Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:7-11 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ================================================================================ Install 1 Package Total download size: 15 k Installed size: 24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:01 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch 1/1 Verifying : epel-release-7-11.noarch 1/1 Installed: epel-release.noarch 0:7-11 Complete!

Rebuild cache of yum repositories.

[root@kubemaster-01 ~]# yum clean all Loaded plugins: fastestmirror Cleaning repos: base docker-ce-stable epel extras kubernetes updates Cleaning up list of fastest mirrors [root@kubemaster-01 ~]# yum makecache fast Loaded plugins: fastestmirror Determining fastest mirrors epel/x86_64/metalink | 7.9 kB 00:00 * base: ftp3.isra.edu.pk * epel: mirrors.nipa.cloud * extras: ftp3.isra.edu.pk * updates: ftp3.isra.edu.pk base | 3.6 kB 00:00 docker-ce-stable | 3.5 kB 00:00 epel | 4.7 kB 00:00 extras | 3.4 kB 00:00 kubernetes/signature | 454 B 00:00 kubernetes/signature | 1.4 kB 00:00 !!! updates | 3.4 kB 00:00 (1/10): base/7/x86_64/group_gz | 166 kB 00:00 (2/10): epel/x86_64/group_gz | 88 kB 00:00 (3/10): docker-ce-stable/x86_64/updateinfo | 55 B 00:01 (4/10): docker-ce-stable/x86_64/primary_db | 28 kB 00:01 (5/10): extras/7/x86_64/primary_db | 201 kB 00:01 (6/10): kubernetes/primary | 49 kB 00:01 (7/10): epel/x86_64/updateinfo | 1.0 MB 00:05 (8/10): updates/7/x86_64/primary_db | 5.0 MB 00:13 (9/10): epel/x86_64/primary_db | 6.7 MB 00:25 (10/10): base/7/x86_64/primary_db | 6.0 MB 00:28 kubernetes 351/351 Metadata Cache Created

Install cockpit using yum command.

[root@kubemaster-01 ~]# yum install -y cockpit Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp3.isra.edu.pk * epel: mirrors.nipa.cloud * extras: ftp3.isra.edu.pk * updates: ftp3.isra.edu.pk Resolving Dependencies --> Running transaction check ---> Package cockpit.x86_64 0:176-4.el7.centos will be installed --> Processing Dependency: cockpit-ws for package: cockpit-176-4.el7.centos.x86_64 --> Processing Dependency: cockpit-system for package: cockpit-176-4.el7.centos.x86_64 --> Processing Dependency: cockpit-bridge for package: cockpit-176-4.el7.centos.x86_64 --> Running transaction check ---> Package cockpit-bridge.x86_64 0:176-4.el7.centos will be installed --> Processing Dependency: glib-networking for package: cockpit-bridge-176-4.el7.centos.x86_64 --> Processing Dependency: libjson-glib-1.0.so.0()(64bit) for package: cockpit-bridge-176-4.el7.centos.x86_64 ---> Package cockpit-system.noarch 0:176-4.el7.centos will be installed ---> Package cockpit-ws.x86_64 0:176-4.el7.centos will be installed --> Running transaction check ---> Package glib-networking.x86_64 0:2.56.1-1.el7 will be installed --> Processing Dependency: libgnutls.so.28(GNUTLS_3_1_0)(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_3_0_0)(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_2_12)(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28(GNUTLS_1_4)(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: gsettings-desktop-schemas for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: libproxy.so.1()(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 --> Processing Dependency: libgnutls.so.28()(64bit) for package: glib-networking-2.56.1-1.el7.x86_64 ---> Package json-glib.x86_64 0:1.4.2-2.el7 will be installed --> Running transaction check ---> Package gnutls.x86_64 0:3.3.29-9.el7_6 will be installed --> Processing Dependency: trousers >= 0.3.11.2 for package: gnutls-3.3.29-9.el7_6.x86_64 --> Processing Dependency: libnettle.so.4()(64bit) for package: gnutls-3.3.29-9.el7_6.x86_64 --> Processing Dependency: libhogweed.so.2()(64bit) for package: gnutls-3.3.29-9.el7_6.x86_64 ---> Package gsettings-desktop-schemas.x86_64 0:3.28.0-2.el7 will be installed ---> Package libproxy.x86_64 0:0.4.11-11.el7 will be installed --> Processing Dependency: libmodman.so.1()(64bit) for package: libproxy-0.4.11-11.el7.x86_64 --> Running transaction check ---> Package libmodman.x86_64 0:2.0.1-8.el7 will be installed ---> Package nettle.x86_64 0:2.7.1-8.el7 will be installed ---> Package trousers.x86_64 0:0.3.14-2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: cockpit x86_64 176-4.el7.centos extras 47 k Installing for dependencies: cockpit-bridge x86_64 176-4.el7.centos extras 497 k cockpit-system noarch 176-4.el7.centos extras 1.2 M cockpit-ws x86_64 176-4.el7.centos extras 796 k glib-networking x86_64 2.56.1-1.el7 base 145 k gnutls x86_64 3.3.29-9.el7_6 updates 680 k gsettings-desktop-schemas x86_64 3.28.0-2.el7 base 605 k json-glib x86_64 1.4.2-2.el7 base 134 k libmodman x86_64 2.0.1-8.el7 base 28 k libproxy x86_64 0.4.11-11.el7 base 64 k nettle x86_64 2.7.1-8.el7 base 327 k trousers x86_64 0.3.14-2.el7 base 289 k Transaction Summary ================================================================================ Install 1 Package (+11 Dependent packages) Total download size: 4.7 M Installed size: 12 M Downloading packages: (1/12): cockpit-176-4.el7.centos.x86_64.rpm | 47 kB 00:04 (2/12): glib-networking-2.56.1-1.el7.x86_64.rpm | 145 kB 00:06 (3/12): cockpit-bridge-176-4.el7.centos.x86_64.rpm | 497 kB 00:08 (4/12): json-glib-1.4.2-2.el7.x86_64.rpm | 134 kB 00:01 (5/12): libmodman-2.0.1-8.el7.x86_64.rpm | 28 kB 00:00 (6/12): cockpit-ws-176-4.el7.centos.x86_64.rpm | 796 kB 00:10 (7/12): libproxy-0.4.11-11.el7.x86_64.rpm | 64 kB 00:00 (8/12): cockpit-system-176-4.el7.centos.noarch.rpm | 1.2 MB 00:11 (9/12): gnutls-3.3.29-9.el7_6.x86_64.rpm | 680 kB 00:07 (10/12): trousers-0.3.14-2.el7.x86_64.rpm | 289 kB 00:01 (11/12): gsettings-desktop-schemas-3.28.0-2.el7.x86_64.rpm | 605 kB 00:07 (12/12): nettle-2.7.1-8.el7.x86_64.rpm | 327 kB 00:04 -------------------------------------------------------------------------------- Total 301 kB/s | 4.7 MB 00:16 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : json-glib-1.4.2-2.el7.x86_64 1/12 Installing : nettle-2.7.1-8.el7.x86_64 2/12 Installing : libmodman-2.0.1-8.el7.x86_64 3/12 Installing : libproxy-0.4.11-11.el7.x86_64 4/12 Installing : gsettings-desktop-schemas-3.28.0-2.el7.x86_64 5/12 Installing : trousers-0.3.14-2.el7.x86_64 6/12 Installing : gnutls-3.3.29-9.el7_6.x86_64 7/12 Installing : glib-networking-2.56.1-1.el7.x86_64 8/12 Installing : cockpit-bridge-176-4.el7.centos.x86_64 9/12 Installing : cockpit-system-176-4.el7.centos.noarch 10/12 Installing : cockpit-ws-176-4.el7.centos.x86_64 11/12 Installing : cockpit-176-4.el7.centos.x86_64 12/12 Verifying : trousers-0.3.14-2.el7.x86_64 1/12 Verifying : gsettings-desktop-schemas-3.28.0-2.el7.x86_64 2/12 Verifying : libmodman-2.0.1-8.el7.x86_64 3/12 Verifying : cockpit-176-4.el7.centos.x86_64 4/12 Verifying : glib-networking-2.56.1-1.el7.x86_64 5/12 Verifying : cockpit-system-176-4.el7.centos.noarch 6/12 Verifying : nettle-2.7.1-8.el7.x86_64 7/12 Verifying : cockpit-ws-176-4.el7.centos.x86_64 8/12 Verifying : gnutls-3.3.29-9.el7_6.x86_64 9/12 Verifying : json-glib-1.4.2-2.el7.x86_64 10/12 Verifying : libproxy-0.4.11-11.el7.x86_64 11/12 Verifying : cockpit-bridge-176-4.el7.centos.x86_64 12/12 Installed: cockpit.x86_64 0:176-4.el7.centos Dependency Installed: cockpit-bridge.x86_64 0:176-4.el7.centos cockpit-system.noarch 0:176-4.el7.centos cockpit-ws.x86_64 0:176-4.el7.centos glib-networking.x86_64 0:2.56.1-1.el7 gnutls.x86_64 0:3.3.29-9.el7_6 gsettings-desktop-schemas.x86_64 0:3.28.0-2.el7 json-glib.x86_64 0:1.4.2-2.el7 libmodman.x86_64 0:2.0.1-8.el7 libproxy.x86_64 0:0.4.11-11.el7 nettle.x86_64 0:2.7.1-8.el7 trousers.x86_64 0:0.3.14-2.el7 Complete!

Enable and start Cockpit service.

[root@kubemaster-01 ~]# systemctl enable cockpit.socket Created symlink from /etc/systemd/system/sockets.target.wants/cockpit.socket to /usr/lib/systemd/system/cockpit.socket. [root@kubemaster-01 ~]# systemctl start cockpit.socket

Allow Cockpit Service in Linux firewall.

[root@kubemaster-01 ~]# firewall-cmd --permanent --add-service=cockpit success [root@kubemaster-01 ~]# firewall-cmd --reload success

Browse URL https://kubemaster-01.example.com:9090/ in a client's browser. You may encounter a security certificate warning; just ignore it and continue.

01-cockpit-web-ui-login

Login as root user.

02-cockpit-system-panel

We are now at the system panel of Cockpit. We can monitor system performance here and modify a couple of settings like hostname, system time, etc.

03-cockpit-networking-panel

04-cockpit-accounts-panel

05-cockpit-services-panel

We also have some other panels here like Logs, Networking, Accounts, Services, etc. However, we are installing Cockpit to control our Kubernetes cluster from here. Therefore, we have to add required functionality in Cockpit Web UI.

Install following packages to add the Kubernetes and Docker control panels in Cockpit Web UI.

[root@kubemaster-01 ~]# yum install -y cockpit-docker cockpit-kubernetes Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp3.isra.edu.pk * epel: mirrors.nipa.cloud * extras: ftp3.isra.edu.pk * updates: ftp3.isra.edu.pk Resolving Dependencies --> Running transaction check ---> Package cockpit-docker.x86_64 0:176-4.el7.centos will be installed extras/7/x86_64/filelists_db | 243 kB 00:01 ---> Package cockpit-kubernetes.x86_64 0:176-4.el7.centos will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: cockpit-docker x86_64 176-4.el7.centos extras 310 k cockpit-kubernetes x86_64 176-4.el7.centos extras 4.1 M Transaction Summary ================================================================================ Install 2 Packages Total download size: 4.4 M Installed size: 11 M Downloading packages: (1/2): cockpit-docker-176-4.el7.centos.x86_64.rpm | 310 kB 00:11 (2/2): cockpit-kubernetes-176-4.el7.centos.x86_64.rpm | 4.1 MB 00:13 -------------------------------------------------------------------------------- Total 320 kB/s | 4.4 MB 00:14 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : cockpit-kubernetes-176-4.el7.centos.x86_64 1/2 Installing : cockpit-docker-176-4.el7.centos.x86_64 2/2 Verifying : cockpit-docker-176-4.el7.centos.x86_64 1/2 Verifying : cockpit-kubernetes-176-4.el7.centos.x86_64 2/2 Installed: cockpit-docker.x86_64 0:176-4.el7.centos cockpit-kubernetes.x86_64 0:176-4.el7.centos Complete!

Restart Cockpit service.

[root@kubemaster-01 ~]# systemctl restart cockpit.socket

Cockpit Web UI will be disconnected due to restart of cockpit.service.

06-cockpit-disconnect

Click on Reconnect.

01-cockpit-web-ui-login

Login as root user.

07-cockpit-system-panel

Now you see some new controls on the right side of the console.

Click on Containers, it provides Docker related control panel.

08-cockpit-conatiners-panel

Click on Cluster to manager Kubernetes cluster.

09-cockpit-kunernetes-panel

10-cockpit-kunernetes-panel

We can add more control panels in the same way.

You may have notice that the Cockpit lacks a storage control panel. It is because Cockpit do not install Storage panel by default.

Therefore, to add Storage related control panel in Cockpit Web UI, we have to install cockpit-storaged package using yum command.

[root@kubemaster-01 ~]# yum install -y cockpit-storaged ... Installed: cockpit-storaged.noarch 0:176-4.el7.centos Dependency Installed: device-mapper-multipath.x86_64 0:0.4.9-123.el7 device-mapper-multipath-libs.x86_64 0:0.4.9-123.el7 dosfstools.x86_64 0:3.0.20-10.el7 gdisk.x86_64 0:0.8.10-2.el7 iscsi-initiator-utils.x86_64 0:6.2.0.874-10.el7 iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.874-10.el7 libatasmart.x86_64 0:0.19-6.el7 libblockdev.x86_64 0:2.18-3.el7 libblockdev-crypto.x86_64 0:2.18-3.el7 libblockdev-fs.x86_64 0:2.18-3.el7 libblockdev-loop.x86_64 0:2.18-3.el7 libblockdev-lvm.x86_64 0:2.18-3.el7 libblockdev-mdraid.x86_64 0:2.18-3.el7 libblockdev-part.x86_64 0:2.18-3.el7 libblockdev-swap.x86_64 0:2.18-3.el7 libblockdev-utils.x86_64 0:2.18-3.el7 libbytesize.x86_64 0:1.2-1.el7 libgudev1.x86_64 0:219-62.el7_6.6 libreport-filesystem.x86_64 0:2.1.11-42.el7.centos libudisks2.x86_64 0:2.7.3-8.el7 mdadm.x86_64 0:4.1-rc1_2.el7 mpfr.x86_64 0:3.1.1-4.el7 udisks2.x86_64 0:2.7.3-8.el7 udisks2-iscsi.x86_64 0:2.7.3-8.el7 udisks2-lvm2.x86_64 0:2.7.3-8.el7 volume_key-libs.x86_64 0:0.3.9-8.el7 Dependency Updated: systemd.x86_64 0:219-62.el7_6.6 systemd-libs.x86_64 0:219-62.el7_6.6 systemd-sysv.x86_64 0:219-62.el7_6.6 Complete!

Restart Cockpit service.

[root@kubemaster-01 ~]# systemctl restart cockpit.socket

Reconnect again to Cockpit Web UI and you may find the Storage Panel there.

11-cockpit-storage-panel

If you are installing on a KVM host then you must install cockpit-machines package to add a control panel to manage Virtual machines.

We have successfully installed Cockpit Web UI on CentOS 7 and added Docker and Kubernetes support in Cockpit.

Install Cockpit Web UI on CentOS 7


YOU MIGHT ALSO LIKE:

No comments:

Post a Comment