Eliminar Kernels antiguos en RHEL y CentOS

Paso 1
Listar los kernels

# rpm -q kernel
kernel-3.10.0-327.36.3.el7.x86_64
kernel-3.10.0-514.2.2.el7.x86_64
kernel-3.10.0-693.5.2.el7.x86_64

Paso 2
Desinstalar por yum


# yum remove kernel-3.10.0-327.36.3.el7.x86_64 kernel-3.10.0-514.2.2.el7.x86_64
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-327.36.3.el7 will be erased
---> Package kernel.x86_64 0:3.10.0-514.2.2.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================================
 Package                                         Arch                                            Version                                                      Repository                                          Size 
=======================================================================================================================================================================================================================
Removing:                                                                                                                                                                                                              
 kernel                                          x86_64                                          3.10.0-327.36.3.el7                                          @anaconda                                          136 M 
 kernel                                          x86_64                                          3.10.0-514.2.2.el7                                           @updates                                           148 M 
                                                                                                                                                                                                                       
Transaction Summary                                                                                                                                                                                                    
=======================================================================================================================================================================================================================
Remove  2 Packages                                                                                                                                                                                                     
                                                                                                                                                                                                                       
Installed size: 284 M                                                                                                                                                                                                  
Is this ok [y/N]:

Paso 2 .1
Remover por package-cleanup

# package-cleanup --oldkernels --count=1
Loaded plugins: fastestmirror
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-327.36.3.el7 will be erased
---> Package kernel.x86_64 0:3.10.0-514.2.2.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================================================================
 Package                                         Arch                                            Version                                                      Repository                                          Size
=======================================================================================================================================================================================================================
Removing:
 kernel                                          x86_64                                          3.10.0-327.36.3.el7                                          @anaconda                                          136 M
 kernel                                          x86_64                                          3.10.0-514.2.2.el7                                           @updates                                           148 M

Transaction Summary
=======================================================================================================================================================================================================================
Remove  2 Packages

Installed size: 284 M
Is this ok [y/N]:

Si queremos que se eliminen automáticamente podemos editar el archivo:


/etc/yum.conf

Encontrarás una configuración de este estilo:

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=2
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

Ahí encontraremos la siguiente línea: installonly_limit=2

La cambiaremos por el número de kernels que queramos tener viejos.

Servicios y Load Balancers en Kubernetes – Pelado Nerd

00-namespace.yaml

kind: Namespace 
apiVersion: v1 
metadata:   
  name: testing

01-wordpress-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: wordpress
spec:
  ports:
  - port: 80
    targetPort: 80
  selector:
    role: wordpress

02-wordpress-rc.yaml

apiVersion: v1
kind: ReplicationController
metadata:
  name: wordpress
spec:
  replicas: 1
  template:
    metadata:
      labels:
        role: wordpress
    spec:
      containers:
      - name: wordpress
        image: wordpress:php7.1-apache
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80

02-wordpress-service-node-port.yaml

apiVersion: v1
kind: Service
metadata:
  name: wordpress
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30000
  selector:
    role: wordpress

03-wordpress-service-lb.yaml

apiVersion: v1
kind: Service
metadata:
  name: wordpress-lb
spec:
  type: LoadBalancer
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
    name: http
  selector:
    role: wordpress

Cluster de Kubernetes – Pelado Nerd

00-namespace.yaml

kind: Namespace
apiVersion: v1
metadata:
  name: testing

01-wordpress-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: wordpress
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30000
  selector:
    role: wordpress

02-wordpress-rc.yaml

apiVersion: v1
kind: ReplicationController
metadata:
  name: wordpress
spec:
  replicas: 1
  template:
    metadata:
      labels:
        role: wordpress
    spec:
      containers:
      - name: wordpress
        image: wordpress:php7.1-apache
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80