To install kubectl without using sudo on Ubuntu 22, you can follow these steps:

 

Download kubectl binary:
Open a terminal and use `curl` to download the kubectl binary from the official Kubernetes repository. Make sure to download the appropriate version for your platform (e.g., 64-bit Linux):

curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"

 

Create a local bin directory:
Next, create a local `bin` directory in your home folder where you'll store the kubectl binary:

mkdir -p ~/bin

Cheat Sheet of common Kubernetes commands.

 

kubectl version: Check the Kubernetes client and server version.

kubectl version

 

kubectl cluster-info: Display cluster information.

kubectl cluster-info

 

kubectl get: List resources in the cluster.

# List all pods in the default namespace
kubectl get pods

# List all services in the kube-system namespace
kubectl get services -n kube-system

# List all nodes in the cluster
kubectl get nodes

# Get detailed information about a specific resource
kubectl get pods my-pod

# Get pods matching a string in a given namespace
kubectl -n my-namespace get pods | grep resource-first-letters-of-name

# Get deployments in a given namespace
kubectl -n my-namespace get deployments

Cheat Sheet of most used Git commands and how to use them.

 

1. **git init**: Initializes a new Git repository in the current directory.

$ git init
Initialized empty Git repository in /path/to/your/repository/.git/

 

2. **git clone**: Copies an existing Git repository from a remote server to your local machine.

$ git clone https://github.com/username/repository.git

To insert data using Symfony with Doctrine, you need to follow these steps:

 

Create an Entity Class

First, you need to create an entity class that represents the table in your database. An entity class is a PHP class that defines the structure of the table and its properties. For example, let's say we want to create an entity class for a Product table with fields id, name, and price.

// src/Entity/Product.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="products")
 */
class Product
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;

    /**
     * @ORM\Column(type="string")
     */
    private $name;

    /**
     * @ORM\Column(type="decimal", precision=10, scale=2)
     */
    private $price;

    // Getters and Setters for properties (not shown here for brevity)
}