Using the steps below we will create a kubernetes cluster and worker nodes within the IONOS environment, we will then deploy a simple whoami environment that will take an incoming http request and display information on the incoming IP address and browser.
Setup IONOS managed Kubernetes in DCD
- Login to DCD and go to the “Data Center” menu at the top, in the menu under “Create Data Center” enter a name for the data center and select the location you would like to create your data center in, then click “Create Data Center”
- From the left side, click and drag the “Server” icon to the DCD grid
- Once placed, click the plus sign on the server and drag the line to the cloud icon (internet connection) to create LAN with internet access
- From the left palette click on the HDD Storage icon and drag onto newly created server, this will add storage to your server
- Click on “Provision Changes” in the lower right
- Ignore errors for names in the pop up window and click provision now
- After the server is complete click on the“Manager” menu and select “Kubernetes Manager”
- In Kubernetes manager select “Create Cluster” and give it a name you want, this will create your managed Kubernetes cluster. (mau tak up to 10 minutes to create
- Once the cluster is created, select the newly created cluster and on the right side select the tab “Node pools in Cluster” then click the “+ Create node pool” directly below.
- In Pool Settings screen give the node pool a name
- Select the data center that was created in the previous steps
- Under “Node Template” select the CPU to use (AMD/Intel) and number of cores and RAM
- Under “Storage Type” select HDD or SSD and enter desired size
- Click “Create node pool” (creation may take 30 minutes) Creation is complete when a green dot appears next to the node pool name.
Install kubectl and download kubeconfig.yaml from IONOS DCD (linux)
- sudo apt-get update
- sudo apt-get install -y apt-transport-https ca-certificates curl
- sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
- echo “deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main” | sudo tee /etc/apt/sources.list.d/kubernetes.list
- sudo apt-get update
- sudo apt-get install -y kubectl
Deploy a simple whoami instance
These files and instructions will configure a single pod and load balancer service within your kubernetes environment and assign an externally routed address to it. This is for example purposes only.
- Go to https://github.com/ionoslabs/k8s-whoami and copy the contents of the ionos-whoami.yaml you can also git clone this repo to your local machine via git clone https://github.com/ionoslabs/k8s-whoami
- Create a local file called ionos-whoami.yaml and paste the contents of the github ionos-whoami.yaml file to your local file
- At a command prompt in the same location as the previously created .yaml file run “kubectl apply -f name-of-yaml-file.yaml”
- This will spin up the environment with a single web server pod, persistent storage, and load balancer within the IONOS cluster
- Now run “kubectl get all” and note the “External-IP”
- Enter the external-IP address into a web browser and you should get a response listing your computers web browser and connection parameters