DEV Community

Cover image for Install KUBERNETES (EKS-D)
Anderson Gama
Anderson Gama

Posted on • Edited on

Install KUBERNETES (EKS-D)

Install KUBERNETES (EKS-D)

OS: UBUNTU

Install Kubectl

sudo snap install kubectl --classic
Enter fullscreen mode Exit fullscreen mode

Install Amazon EKS Distro (EKS-D)

sudo snap install eks --classic --edge
Enter fullscreen mode Exit fullscreen mode
eks (1.18/edge) v1.18.9 from Canonical✓ installed
Enter fullscreen mode Exit fullscreen mode

Check the status

eks status --wait-ready
Enter fullscreen mode Exit fullscreen mode
eks is running
high-availability: no
  datastore master nodes: 127.0.0.1:19001
  datastore standby nodes: none
Enter fullscreen mode Exit fullscreen mode

Give execution permission to the current user

sudo usermod -a -G eks $USER
sudo chown -f -R $USER ~/.kube
Enter fullscreen mode Exit fullscreen mode

Export the current EKS-D configuration information for use with Kubectl

mkdir -p $HOME/.kube
sudo eks config > .kube/config
Enter fullscreen mode Exit fullscreen mode

Inspect the installation

eks inspect | grep running
Enter fullscreen mode Exit fullscreen mode
  Service snap.eks.daemon-cluster-agent is running
  Service snap.eks.daemon-containerd is running
  Service snap.eks.daemon-apiserver is running
  Service snap.eks.daemon-apiserver-kicker is running
  Service snap.eks.daemon-control-plane-kicker is running
  Service snap.eks.daemon-proxy is running
  Service snap.eks.daemon-kubelet is running
  Service snap.eks.daemon-scheduler is running
  Service snap.eks.daemon-controller-manager is running
Enter fullscreen mode Exit fullscreen mode

Check the version of Containerd

eks ctr --version
Enter fullscreen mode Exit fullscreen mode
ctr github.com/containerd/containerd v1.3.7
Enter fullscreen mode Exit fullscreen mode

Server / Client version

eks ctr version
Enter fullscreen mode Exit fullscreen mode
Client:
  Version:  v1.3.7
  Revision: 8fba4e9a7d01810a393d5d25a3621dc101981175

Server:
  Version:  v1.3.7
  Revision: 8fba4e9a7d01810a393d5d25a3621dc101981175
  UUID: 339017b3-570e-43bd-a528-4a08123868ca
Enter fullscreen mode Exit fullscreen mode

Access Kubernetes

EKS-D comes with its own version of Kubectl to access Kubernetes. Below we will cover 2 different forms of access to view the "nodes" and "services":

Conventional

eks kubectl get nodes
Enter fullscreen mode Exit fullscreen mode
NAME           STATUS   ROLES    AGE   VERSION
myuser         Ready    <none>   33m   v1.18.9-eks-1-18-1
Enter fullscreen mode Exit fullscreen mode
eks kubectl get services
Enter fullscreen mode Exit fullscreen mode
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.152.183.1   <none>        443/TCP   33m
Enter fullscreen mode Exit fullscreen mode

Recommended

kubectl get nodes
Enter fullscreen mode Exit fullscreen mode
NAME           STATUS   ROLES    AGE   VERSION
myuser         Ready    <none>   33m   v1.18.9-eks-1-18-1
Enter fullscreen mode Exit fullscreen mode
kubectl get services
Enter fullscreen mode Exit fullscreen mode
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.152.183.1   <none>        443/TCP   33m
Enter fullscreen mode Exit fullscreen mode

Note: As shown, the 2 forms have the same result, but from this point on we will only use the "Recommended" with Kubectl.

Deploy a test application

kubectl create deployment nginx --image=nginx
Enter fullscreen mode Exit fullscreen mode
deployment.apps/nginx created
Enter fullscreen mode Exit fullscreen mode
kubectl get pods
Enter fullscreen mode Exit fullscreen mode
NAME                    READY   STATUS    RESTARTS   AGE
nginx-f89759699-2w75l   1/1     Running   0          33s
Enter fullscreen mode Exit fullscreen mode

Starting and stopping EKS-D

EKS-D will continue to run until you decide to stop it. You can stop and start with the commands below:

sudo eks stop
Enter fullscreen mode Exit fullscreen mode
Stopped.
Enter fullscreen mode Exit fullscreen mode
sudo eks start
Enter fullscreen mode Exit fullscreen mode
Started.
Enter fullscreen mode Exit fullscreen mode

Basic information of your Kubernetes cluster

Server/Client version

kubectl version --short=true
Enter fullscreen mode Exit fullscreen mode
Client Version: v1.19.4
Server Version: v1.18.9-1+c787d4d0c397b8
Enter fullscreen mode Exit fullscreen mode

Cluster information

kubectl cluster-info
Enter fullscreen mode Exit fullscreen mode
Kubernetes master is running at https://192.168.254.100:16443
CoreDNS is running at https://192.168.254.100:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://192.168.254.100:16443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy
Enter fullscreen mode Exit fullscreen mode

Configuration information

kubectl config view
Enter fullscreen mode Exit fullscreen mode
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://192.168.254.100:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: REDACTED
Enter fullscreen mode Exit fullscreen mode

Note: To view the access token, use the "--flatten=true" option.

View the nodes

kubectl get nodes -w
Enter fullscreen mode Exit fullscreen mode
NAME           STATUS   ROLES    AGE   VERSION
myuser         Ready    <none>   33h   v1.18.9-eks-1-18-1
Enter fullscreen mode Exit fullscreen mode

Information about a particular node

kubectl describe node myuser
Enter fullscreen mode Exit fullscreen mode

Source:

https://microk8s.io/

https://microk8s.io/docs/commands

https://snapcraft.io/eks

https://snapcraft.io/kubectl

https://ubuntu.com/blog/install-amazon-eks-distro-anywhere

Top comments (0)