Thứ Tư, 24 tháng 7, 2019

Install Kubernetes using kubeadm with two nodes master & worker


Well come back for a long time my friends!

Today I want to take a note about some basic knowledge about Kubernetes. I hope that it will be useful for you (Absolutely it's useful for me 😃😃😃)


This will take a lot of time to tell about Kubernetes Architecture. So I will add a link about this. I think that it will help you to find out more: http://bit.ly/2YhqwLy

Now we can go directly about the main task of this article. As the title, I only note something that I see that it's the most important and be helpful for me when I use Kubernetes. If you see anything else, you can add comments and we can discuss more.

Install Kubernetes

In this article, I will install Kubernetes using two nodes (Master and worker) on two Virtual machine:
  • Master node: k8s-master-node: 192.168.1.200
  • Worker node: k8s-worker-node: 192.3168.1.201

Environment

  • Target: Ubuntu
  • Tool: kubeadm. There are many ways to install but I like kubeadm because it's simple and easy to install and use.

Step by step to install

  • Create hostname: On terminal of master and worker, we set up the hostname:
    • On master: sudo hostnamectl set-hostname k8s-master-node 
    • On worker: sudo hostnamectl set-hostname k8s-worker-node 
  • Update hosts file: Add following lines to /etc/hosts (Remember to change the IP of master and worker as your IPs)
192.168.1.200      k8s-master-node
192.3168.1.201    k8s-worker-node

After install docker, if you do not want to you sudo each time you run docker or docker-compose command, you can follow these link to resolve: https://docs.docker.com/install/linux/linux-postinstall/


  • Configure Kubernetes Package Repository on Master & Worker Nodes

sudo apt-get install apt-transport-https curl -y
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
sudo apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main"

  • Disable Swap and Install Kubeadm on all the nodes

sudo swapoff -a
sudo apt-get install kubeadm -y 

  • Initialize and Start Kubernetes Cluster on Master Node using Kubeadm
sudo kubeadm init --pod-network-cidr=172.168.10.0/24
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config 

  • Create token and join worker to master
    • Create token in master node: kubeadm token create --print-join-command 
    • Copy output command and run in worker node

See the nodes

  • kubectl get nodes

Thứ Hai, 15 tháng 7, 2013

A new project will be coming soon

It is a wonderful feeling when you create a product and introduce it to other people.  After FEW is complete, i want to build a project that allows us to monitor any programs' status in the computer. I want to use Python programming language in Windows platform.
If anyone wants to do with me, please send an email to me and we will disscuss together.
Thanks for your attention!

FEW (Funny English Way) new beta version (1.1.0)

      At the begining, i am very sorry for my comment in FEW beta version topic. Because there are some new features that i want to update for new version, today i am be able to publish new version.
      In this version, we can see a really new interface that can help you to understand how to use it clearly. I will not say more about these features. I will only provide some pictures about new version and i want you to try it by yourself.
1. Choosing subject and how many words that you want to learn or review
   

2. Viewing word, it's pronounciation and listenning how to speak it


3. Deleting word(s)


4. Looking up words


5. Configuring software

6. Reading User guide and introduction





And this is two links to download my software:
1. For x86

FEWx86

2. For x64

FEWx64

Thanks all!

Thứ Bảy, 13 tháng 7, 2013

FEW beta version

This is very long time from the last writing. So, today, i want to introduce you one of my products. It's name is FEW (Funny English Way). It's major duty is to help us to note and learn new words in english.
In this application, you can operate your words in subjects. In each subject, you can note, learn and review your words.
1. Beginning interface

In this interface, you can create a new subject or choose the subject and how many words that you want to learn.

2. Main interface
You can add new words or choose the way that you learn them. You also can look up new words if you choose "Tra từ" option.



I built my application in Windows and C#.NET 2.0  platform.
FEW is an free software that You can download and use  in one of two options (But x86 instruction can run very well in all plaform include x64 and x86):
1. For x86 instruction

Funny English Way - x86

2. For x64 instruction

Funny English Way - X64


I hope you can use it effectively in the your best. I am believe that it is able to help you to improve your new words. It can change your new words to your popular words if you practice regularly.

Thanks for reading and using my application.

P/S: 
+ My application is not a perfect software, so, if you get any errors or questions, please send email to me following this address: cuongit.bkhn@gmail.com or post your comments at the end of this page.
+ Do not use this software for any purpose of trading


Thứ Năm, 10 tháng 11, 2011

Convert int to std::string and long long to std::string

This is a long time i have never had a post. Today,  i will introduce you how to convert int and long long number to std::string.
When i join in a project about fuzzing browsers, i have to use a very large data type because i must count the number of requests to browsers and this course is continuous and it occures in a very and very long time.
So i think about long long data format. But when you send information to a browser, you must send a string request and if so, you need to convert long long to string before you send it.
When i got this problem, i found it on the internet in many famous websites, and the more websites i flurted, the more information i got. After that, i synthesized all information that i had and my work is well done.
In this topic i will introduce mainly about long long to std::string because "int" is a very popular data type.
"long long" is a data type that is used in C++, it is 64bits in length.  it's range in signed is from (-2^63) to (2^63 - 1) and in unsigned is from 0 to 2^64 - 1, so you can see it is a very and very range. This is the reason that i choose it for my project.
And now, i will introduce to convert this data type to std::string

+ Convert int to std::string



std::string IntToString(int number)
{
std::stringstream out;
out << number;
return out.str();
}

+ Convert long long to std::string


std::string LongLongToString(unsigned long long number)
{
std::stringstream out;
out << number;
return out.str();
}


To use two function, you need to declare some librabry, such as: <string> and <sstream>
I hope this information will help you in your work.
Thanks for visiting my blog.
Do your best, the rest will come!

Thứ Năm, 21 tháng 7, 2011

Relax corner

Come back to me - David Cook

Lyric:
You say you gotta go and find yourself
You say that you're becoming someone else
Don't recognize the face in the mirror
Looking back at you

You say you're leavin
As you look away
I know theres really nothin left to say
Just know i'm here
Whenever you need me
I'll wait for you

So i'll let you go
I'll set you free
And when you see what you need to see
When you find you come back to me

Take your time i wont go anywhere
Picture you with the wind in your hair
I'll keep your things right where you left them
I'll be here for you

Oh and i'll let you go
I'll set you free
And when you see what you need to see
When you find you come back to me

And i hope you find everything that you need
I'll be right here waiting to see
You find you come back to me

I can't get close if your not there
I can't get inside if theres no soul to bear
I can't fix you i can't save you
Its something you have to do

So i'll let you go
I'll set you free
And when you see what you need to see
When you find you come back to me
Come back to me
So i'll let you go
I'll set you free
And when you see what you need to see
When you find you come back to me

And i hope you find everything that you need
I'll be right here waiting to see
You find you come back to me

When you find you come back to me
When you find you come back to me
When you find you come back to me

How can i browse a folder C++, MFC

I have just finished a project and my project has got an method which allow you create a button for browse an folder. I have created a class to do this duty.

// This is getFolderPath.h
#include "shlobj.h"
#include <string>
class getFolderPath
{
public:
    getFolderPath(void);
    ~getFolderPath(void);
   static  bool GetFolderPath(std::string& folderpath, HWND);
};

// This is getFolderPath.cpp
// You have to add "stdafx.h" library if you make your project in Visual Stdio
#include "getFolderPath.h"

getFolderPath::getFolderPath(void)
{
    /*hOwner = hWnd;*/
}

getFolderPath::~getFolderPath(void)
{
}

bool getFolderPath::GetFolderPath(std::string& folderpath,HWND hOwner)
{
    bool retVal = false;

    // The BROWSEINFO struct tells the shell
    // how it should display the dialog.
    BROWSEINFO bi;
    memset(&bi, 0, sizeof(bi));

    bi.ulFlags   = BIF_USENEWUI;
    bi.hwndOwner = hOwner;
    bi.lpszTitle = NULL;

    // must call this if using BIF_USENEWUI
    ::OleInitialize(NULL);

    // Show the dialog and get the itemIDList for the selected folder.
    LPITEMIDLIST pIDL = ::SHBrowseForFolder(&bi);

    if(pIDL != NULL)
    {
        // Create a buffer to store the path, then get the path.
        char buffer[_MAX_PATH] = {L'\0'};
        if(::SHGetPathFromIDListA(pIDL, buffer) != 0)
        {
            // Set the string value.
            folderpath = buffer;
            retVal = true;
        }       

        // free the item id list
        CoTaskMemFree(pIDL);
    }

    ::OleUninitialize();

    return retVal;
}

How you can use my class.
+ Create two file .h  and  .cpp with their content as  i wrote above.
+ Coppy two file into your project, add "getFolderPath.h" library in you programme
+ In main programme or when you process an event such as click to a button, you report an std::string variable to call GetFolderPath function. Example: std::string path = "";
   - If your application is console application,  hOwner = NULL 
   - If  it is a window application or a MFC application, you have to use it's HWND for GetFolderPath function. You can get it's HWND by this function: this->GetSafeHWND();
If success, (GetFolderPath return true)  path will contain your path to folder which you choose
I use static function static  bool GetFolderPath(std::string& folderpath, HWND); so you can call it although you don't create new object

This is example which i do with console application:

#include "getPathFolder.h"
#include <string>
int main()
{
        std::string sPath = "";
        if(getPathFoder::GetFolderPath(sPath,NULL))
        {
               printf("You have just chosen this folder: %s",sPath.c_str());       
        }
        else
        {
                 // Process when can get folder's path
        }
        return 1;
}
Best wishes for you, thanks for visiting my blog!
Do your best, the rest will come!

Install Kubernetes using kubeadm with two nodes master & worker

Well come back for a long time my friends! Today I want to take a note about some basic knowledge about Kubernetes. I hope that it will...