Showing posts with label kubeadm. Show all posts
Showing posts with label kubeadm. Show all posts

Tuesday, 30 July 2019

Hosting Containerized Cloud-Native Stacks (Kubernetes) on GCP Marketplace

Google Cloud Marketplace is the fastest way for the customers to get started on Google Cloud Platform (GCP). GCP Marketplace offers ready-to-go development stacks, solutions, and services to accelerate development so that the users can spend less time installing and more time developing the application.

Why Google cloud marketplace?
  • Deploy in a few clicks.
  • Production-ready solutions. 
  • Augment platform capabilities. 
  • Streamlined billing.
  • Built using Deployment Manager. 
  • Security update notifications.
Steps to place the application on Google cloud marketplace:

The technical integration of the overall procedure is shown in the below diagram.
The main seven steps need to be followed while placing an application to the marketplace are described below.

Step 1: Fetch the helm chart

Download the helm chart of the application from its repository or write the required helm chart of the application. The helm chart mainly contains values.yaml, chart.yaml, and templates files.
The above diagram shows the sample tree structure of the helm chart. Click here to get to know more about helm charts.

Step 2: Create the initial schema

Write the schema.yaml file for the application because a schema defines the general structure to which files should adhere. The general structure of the schema.yaml file.
Step 3: Add an application descriptor

In the template folder of the helm chart, add a file named application.yaml with the contents shown below. The file mainly describes the application and is used in the UI.
Step 4: Write the Dockerfile

Container images are typically built using a Dockerfile and the docker build command-line tool. It is better to publish the Dockerfile and container build instructions in the public repository for the application. This enables customers to modify or rebuild the images, which is sometimes necessary to certify images for enterprise production environments. If the application image depends on a base image such as Debian, or a language run time image such as Python or OpenJDK, then one must use one of GCP Marketplace's certified container images.

Build the Dockerfile using the following command

sudo docker build -t  mongodb . 

Step 5: Push the Docker image to the registry

Container Registry repository must have the following structure:
  • The Application's main image must be in the root of the repository. The application's image should be in gcr.io/boxbe00034/mongodb format.
  • Deployer folder contains the image to be deployed.
  • If your application uses additional container images, each additional image must be in its own folder. For example, if your application requires an Ubuntu 16.04 image, add the image to gcr.io/boxbe00034/mongodb/ubuntu16_04.
  • All the images in your application must be tagged with the minor version using semantic versioning of the application.  
Push the built application to the remote GCR (Google Container Registry) so that the application running in the cluster can access the image. The command to push the application to the container registry is :

docker --push gcr.io/boxbe00034/mongodb : 4.0

Once you push the application to the registry, the image registry looks as shown below:
Step 6: Submitting the application
  • Enable Partner Portal 
  • Add your solution to partner portal:
In Partner Portal, you must add marketing information about your solution, and set up the product versions that you want to list.
  • Submit solution for review
Step 7: Getting the GCP Marketplace security check

Once you submit the solution, automatically through the GCP Marketplace platform testing and reviewing operations will take place. Automated testing includes security scanning, functional testing, and integration testing. This platform also provides the application’s end-to-end customer experience, including marketing materials, installation flow, security, and user guide.

Summary

When the application is supposed to publish in the marketplace, it should undergo many important steps, which include, building the image, test, deploy and reviewed by the marketplace teams. This document describes the most important steps to be followed while on boarding an application to the GCP marketplace. This procedure can also be followed for publishing applications in other cloud and container marketplaces such as AWS Marketplace, Azure Marketplace, IBM Cloud Marketplace, Oracle Cloud Marketplace and so on, with minimal changes on the platform, programming and operational dependencies respect to marketplace terms and conditions. 

For building custom based cloud-native stack development & integration, hosting private or public marketplace repositories for existing applications and newly build cloud-native stacks, if you require more details about cloud-native microservices & cloud-native stack transformation, please refer to Yobitel Communications. www.yobitel.com





 

Sunday, 30 June 2019

5 Easy Steps To Create a Kubernetes Cluster Using Kubeadm

  • June 28, 2019

    If you want to manually create the cluster (i.e., without GKE) using kubeadm, then this document may help you to do it. Before moving into the procedure it is good to have knowledge on kubeadm.

    Prerequisites:

    OS: Ubuntu version 16.04 or higher
    Minimum Memory required: For master node - 2 CPU's, 8GB memory
                                                 For each worker node - 1 CPU's, 4GB memory

    Let us look into the steps for cluster creation using kubeadm

    Step 1: Docker Installation

    Create the Instances in the GCE , It should be at least one master node and  two or more worker nodes. Follow these steps for all the nodes.

    Docker installation is the primary steps in the cluster creation, so follow the below steps for all the nodes you created. Otherwise you can also look into the official docker documentation for docker installation.
    1. $ sudo apt-get update -y
    2. $ sudo apt-get install -qy docker.io
    Check whether docker got properly installed or not using docker --version command 

    Step 2: Install Kubeadm
    • Get Kubernetes repo key
     $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
    • Add Kubernetes repository to manifests
    $ sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"
    • Install Kubeadm 
    $ sudo apt install kubeadm

    Check kubeadm version and make sure it is properly installed or not.

    $ kubeadm version 

    Step 3: Create the cluster

    It is possible to configure kubeadm init with a configuration file instead of command line flags, and some more advanced features may only be available as configuration file options. This file is passed in the --config option.

    On master node:

    Initialize the kubeadm

    $ sudo kubeadm init [option]

    Options:
    •     --pod-network-cidr=10.244.0.0/16
    •     --config=/root/kubeadm-config.yaml
    •     --cert-dir

    Copy and execute kubectl config file

    $ mkdir -p $HOME/.kube
    $ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    $ sudo chown $(id -u):$(id -g) $HOME/.kube/config

    Step 4: Join worker node

    To join worker nodes to the master node, run the below command separately on each worker node

    As a root user 

    $ kubeadm join 10.156.0.18:6443 --token ow15j0.kz12nltctqeowkiy \
    >     --discovery-token-ca-cert-hash sha256:a7024eacb754a01721f28cedc52e92427a83225db0f800d1bfb9117f2832602c
    To check whether all the pods are active and running, run the following command on the master node.

    $ kubectl get nodes

    Step 5: Troubleshooting
    • When you are initializing kubeadm with cidr, then If you get pods status as not ready  then run the following code in master node
    $ sudo kubectl  apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
    • If you are doing kubeadm init with config file then sample template of the file is shown below.

    Kubeadm-config.yaml sample template



     You can access the yaml file here.

    Tear down:

    To tear down the kubeadm, run these commands on the master node

    $ kubectl drain <node name> — delete-local-data — force — ignore-daemonsets

    $ kubectl delete node <node name>

    Then, on the node being removed, reset all kubeadm installed state:

    $ kubeadm reset