canonical / microk8s

MicroK8s is a small, fast, single-package Kubernetes for datacenters and the edge.
https://microk8s.io
Apache License 2.0
8.42k stars 768 forks source link

Packer + MicroK8s + EC2 #4109

Closed juliusoh closed 2 months ago

juliusoh commented 1 year ago

Summary

I install Microk8s on packer

Via:

`

Install MicroK8s

sudo snap install microk8s --classic sudo usermod -a -G microk8s ubuntu sudo chown -f -R ubuntu ~/.kube sudo -E microk8s status --wait-ready sudo -E microk8s kubectl get nodes sudo -E microk8s kubectl get services sudo -E microk8s reset `

I deploy new EC2 running this AMI

What Should Happen Instead?

I run microk8s kubectl get nodes

I see two nodes

I try to run microk8s reset and get This is a multi-node MicroK8s deployment. Reset is applicable for single node clusters. Please remove all joined nodes before calling reset.

Reproduction Steps

  1. ...
  2. ...

Introspection Report

Can you suggest a fix?

Are you interested in contributing with a fix?

ktsakalozos commented 1 year ago

Hi @juliusoh, how do you see two nodes? Your instructions deploy only one.

juliusoh commented 1 year ago

@ktsakalozos The Packer creates AMI with MicroK8s installed on it, when I provision a new EC2 instance using that AMI, and run microk8s kubectl get nodes, i see 2 nodes.

The first node is the one that packer used to provision the AMI second is the new EC2 i just provisioned

ktsakalozos commented 1 year ago

I have not used Packer but I do not see any join command so I do not see how a cluster of two nodes is created.

juliusoh commented 1 year ago

I have not used Packer but I do not see any join command so I do not see how a cluster of two nodes is created.

Somehow it displays node of the ec2 packer used to provision the ami

So when I install it on the packer it does something that persist that node data

ktsakalozos commented 1 year ago

Ok so this is a ghost node comming from the initial setup. If you try to microk8s kubectl delete node "your_ghost_node" what would happen?

juliusoh commented 1 year ago

Okay that fixes the duplicate ghost node thanks @ktsakalozos

Not sure why the microk8s remove node command didnt work

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.