Saturday, April 29, 2023

How to set proxy for subscription manager

# yum clean all

Loaded plugins: product-id, subscription-manager

timed out


proxy information can be added in subscription-manager configuration file in /etc/rhsm/rhsm.conf manually with following options:


# an http proxy server to use

proxy_hostname =


# port for http proxy server

proxy_port =



references:

https://access.redhat.com/solutions/57669

Redhat Attaching subscriptoin manager

I'm getting the following error when trying to install a package: There is no repository enabled in /etc/yum.repos.d.


I realized that to have access to the redhat repositories I need to have an account on the site, I did that and after that I linked it to my terminal with the commands:


Below is what helped to get over this issue


Un-register the system :


sudo subscription-manager remove --all

sudo subscription-manager unregister

sudo subscription-manager clean


Re-register the system :


sudo subscription-manager register

sudo subscription-manager refresh


Search for the Pool ID :


sudo subscription-manager list --available


Attach the subscription :


sudo subscription-manager attach --pool=<Pool-ID>



https://access.redhat.com/discussions/6394941 

Using kubectl to Create a Deployment

Once you have a running Kubernetes cluster, you can deploy your containerized applications on top of it. To do so, you create a Kubernetes Deployment. The Deployment instructs Kubernetes how to create and update instances of your application. Once you've created a Deployment, the Kubernetes control plane schedules the application instances included in that Deployment to run on individual Nodes in the cluster.


Once the application instances are created, a Kubernetes Deployment controller continuously monitors those instances. If the Node hosting an instance goes down or is deleted, the Deployment controller replaces the instance with an instance on another Node in the cluster. This provides a self-healing mechanism to address machine failure or maintenance.


You can create and manage a Deployment by using the Kubernetes command line interface, kubectl. Kubectl uses the Kubernetes API to interact with the cluster. 



When you create a Deployment, you'll need to specify the container image for your application and the number of replicas that you want to run. You can change that information later by updating your Deployment;


The common format of a kub ectl command is: kubectl action resource



This performs the specified action (like create, describe or delete) on the specified resource (like node or deployment). You can use --help after the subcommand to get additional info about possible parameters (for example: kub ectl get nodes --help).


Check that ku bectl is configured to talk to your cluster, by running the kubectl version command.



Check that kub ectl is installed and you can see both the client and the server versions.



To view the nodes in the cluster, run the kubectl get nodes command.


You see the available nodes. Later, Kubernetes will choose where to deploy our application based on Node available resources.


Let’s deploy our first app on Kubernetes with the kubectl create deployment command. We need to provide the deployment name and app image location (include the full repository url for images hosted outside Docker hub).



ku bectl cr eate deployment kub ernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1


Great! You just deployed your first application by creating a deployment. This performed a few things for you:


searched for a suitable node where an instance of the application could be run (we have only 1 available node)

scheduled the application to run on that Node

configured the cluster to reschedule the instance on a new Node when needed


To list your deployments use the kubectl get deployments command:


k ub ectl get deployments


We see that there is 1 deployment running a single instance of your app. The instance is running inside a container on your node.


View the app

Pods that are running inside Kubernetes are running on a private, isolated network. By default they are visible from other pods and services within the same kubernetes cluster, but not outside that network. When we use kubectl, we're interacting through an API endpoint to communicate with our application.



The kubectl command can create a proxy that will forward communications into the cluster-wide, private network. The proxy can be terminated by pressing control-C and won't show any output while its running.


You need to open a second terminal window to run the proxy.


k u b ectl pr ox y


We now have a connection between our host (the online terminal) and the Kubernetes cluster. The proxy enables direct access to the API from these terminals.


You can see all those APIs hosted through the proxy endpoint. For example, we can query the version directly through the API using the curl command:


cu rl http://localhost:8001/version


The API server will automatically create an endpoint for each pod, based on the pod name, that is also accessible through the proxy.


First we need to get the Pod name, and we'll store in the environment variable POD_NAME:


exp ort POD_NAME=$(kubectl get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')

ec ho Name of the Pod: $POD_NAME


You can access the Pod through the proxied API, by running:


curl h ttp://localhost:8001/api/v1/namespaces/default/pods/$POD_NAME/


In order for the new Deployment to be accessible without using the proxy, a Service is required which will be explained in the next modules.


references:

https://kubernetes.io/docs/tutorials/kubernetes-basics/deploy-app/deploy-intro/

Kubernetes is a cluster orchestration system.

Main tasks are


Deploy a containerized application on a cluster.

Scale the deployment.

Update the containerized application with a new software version.

Debug the containerized application.


With modern web services, users expect applications to be available 24/7, and developers expect to deploy new versions of those applications several times a day. Containerization helps package software to serve these goals, enabling applications to be released and updated without downtime. Kubernetes helps you make sure those containerized applications run where and when you want, and helps them find the resources and tools they need to work. Kubernetes is a production-ready, open source platform designed with Google's accumulated experience in container orchestration, combined with best-of-breed ideas from the community.


Creating a cluster 


Kubernetes coordinates a highly available cluster of computers that are connected to work as a single unit. The abstractions in Kubernetes allow you to deploy containerized applications to a cluster without tying them specifically to individual machines. To make use of this new model of deployment, applications need to be packaged in a way that decouples them from individual hosts: they need to be containerized. Containerized applications are more flexible and available than in past deployment models, where applications were installed directly onto specific machines as packages deeply integrated into the host. Kubernetes automates the distribution and scheduling of application containers across a cluster in a more efficient way. Kubernetes is an open-source platform and is production-ready.



A Kubernetes cluster consists of two types of resources:


The Control Plane coordinates the cluster

Nodes are the workers that run applications


The Control Plane is responsible for managing the cluster. The Control Plane coordinates all activities in your cluster, such as scheduling applications, maintaining applications' desired state, scaling applications, and rolling out new updates


A node is a VM or a physical computer that serves as a worker machine in a Kubernetes cluster. Each node has a Kubelet, which is an agent for managing the node and communicating with the Kubernetes control plane. The node should also have tools for handling container operations, such as containerd or Docker. A Kubernetes cluster that handles production traffic should have a minimum of three nodes because if one node goes down, both an etcd member and a control plane instance are lost, and redundancy is compromised. You can mitigate this risk by adding more control plane nodes.

Control Planes manage the cluster and the nodes that are used to host the running applications.

When you deploy applications on Kubernetes, you tell the control plane to start the application containers. The control plane schedules the containers to run on the cluster's nodes. The nodes communicate with the control plane using the Kubernetes API, which the control plane exposes. End users can also use the Kubernetes API directly to interact with the cluster.


A Kubernetes cluster can be deployed on either physical or virtual machines. To get started with Kubernetes development, you can use Minikube. Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node. Minikube is available for Linux, macOS, and Windows systems. The Minikube CLI provides basic bootstrapping operations for working with your cluster, including start, stop, status, and delete.


references:

https://kubernetes.io/docs/tutorials/kubernetes-basics/


What is kubectl

kubectl. The Kubernetes command-line tool, kubectl, allows you to run commands against Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs. For more information including a complete list of kubectl operations, see the kubectl reference documentation

references:


Friday, April 28, 2023

What is Calico?

 



What is Calico 


Calico is a third-party solution developed to provide flexibility and simplify configuring Kubernetes network connectivity. It is available on all the major cloud platforms and can be installed on bare metal servers. Managing networks in Kubernetes is a complex job that requires experienced administrators


Calico is an open-source CNI (Container Network Interface) plugin for network management developed by Tigera. The plugin aims to simplify Kubernetes networking while making it more scalable and secure.


The NetworkPolicy API, the out-of-the-box network policy management solution for Kubernetes, has a restricted set of features. Limited to a single environment, users can apply network policies created using this API only to labeled pods. Network rules deal only with protocols and ports and can be applied to pods, environments, and subnets.


Calico improves the default Kubernetes networking experience in the following ways:


Rules can use actions like logging, restricting, or permitting. This feature provides administrators with greater flexibility in network configuration.

Aside from ports and protocols, rules can specify port ranges, IPs, node selectors, etc., allowing for a more granular approach to networking.

It extends the list of Kubernetes objects to which users can apply network policies with containers, interfaces, and virtual machines.

It enables the use of DNAT settings and traffic flow management policies.

Interoperability between Kubernetes and non-Kubernetes workloads is possible.

references:


Wednesday, April 26, 2023

Alma Linux set the ip address permanently

 To temporarily set the ip address below is the command 

to install ifconfig if not already available 

yum install net-tools

ifconfig ens192 <ip_address>/<subnet_mask>

ifconfig enp0s3 192.168.178.32/24

ifconfig enp0s3 192.168.178.32 netmask 255.255.255.0


For permanently setting it, below to be followed

ls -l /etc/sysconfig/network-scripts


references:

https://devconnected.com/how-to-change-ip-address-on-linux/