Sunday, 9 July 2023

New update of kubernetes

 Kubernetes 1.27, which was released in April 2023, comes with 60 enhancements, 12 of which are graduating to Stable, 29 are existing features that keep improving, and 18 are completely new

2
5
.
 Some of the new features include:
  • Pod resource updates: Users can now update a Pod's resources without restarting it
    2
    .
  • Improved IP address assignment: Kubernetes 1.27 comes with improvements on how internal IPs are assigned to services
    2
    .
  • New kubectl subcommands via plugins: The release includes new kubectl subcommands via plugins
    2
    .
  • Safer, more performant pruning in kubectl apply: Kubernetes v1.27 introduced changes to Memory QoS (alpha) to improve memory management capabilities in Linux nodes
    1
    .
  • Registry.k8s.io replacing k8s.gcr.io: The newer image registry, registry.k8s.io, is replacing k8s.gcr.io
    5
    .
  • Stable storage capacity tracking and volume expansion: Storage capacity tracking and volume expansion are now stable
    3
    .
In addition to these new features, Kubernetes 1.27 also includes several quality-of-life changes that make everyone's jobs easier
2
.

Monday, 17 April 2023

create a GKE instance on GCP. Also add steps to create a small sample application on java.

 here are the detailed steps to create a GKE instance on GCP and deploy a sample Java application:

  1. Create a GCP project:

    • Log in to the Google Cloud Console and create a new project.
    • Select a unique project ID and project name.
    • Enable billing for the project.
  2. Enable the Kubernetes Engine API:

    • In the Cloud Console, go to the Kubernetes Engine API page.
    • Click "Enable".
  3. Install and set up the Cloud SDK:

    • Download and install the Google Cloud SDK.
    • Authenticate with your Google Cloud account.
  4. Create a Kubernetes cluster:

    • Open the Cloud Console.
    • In the left sidebar, select "Kubernetes Engine" > "Clusters".
    • Click "Create Cluster".
    • Enter a name for the cluster.
    • Choose the zone for the cluster.
    • Select the number of nodes for the cluster.
    • Click "Create".
  5. Configure kubectl to connect to the cluster:

    • In the Cloud Console, go to the Kubernetes Engine > Clusters page.
    • Click "Connect" for the cluster you just created.
    • Run the command that appears in the Cloud Console.
  6. Deploy a sample Java application:

    • Create a new directory for your application.

    • In the directory, create a new file called "Dockerfile" with the following contents:

      VOLUME /tmp ADD target/myapp.jar myapp.jar ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/myapp.jar"]```


    • Create a new file called "deployment.yaml" with the following contents:

      kind: Deployment metadata: name: myapp-deployment labels: app: myapp spec: replicas: 1 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: gcr.io/[PROJECT_ID]/myapp:v1 ports: - containerPort: 8080```

    • Replace [PROJECT_ID] with your actual project ID.

    • In the same directory, run the following command to build and push the Docker image:

      docker build -t gcr.io/[PROJECT_ID]/myapp:v1 . docker push gcr.io/[PROJECT_ID]/myapp:v1

    • Run the following command to deploy the application:

      kubectl apply -f deployment.yaml

  7. Expose the application to the internet:

    • Run the following command to create a Kubernetes service:

      kubectl expose deployment myapp-deployment --type=LoadBalancer --port=80 --target-port=8080

    • Wait for the service to be created.

    • Run the following command to get the external IP address of the service:

      kubectl get service myapp-deployment

    • Visit the external IP address in your web browser to see your application running.