A Kubernetes native application which can manage Virtual Machines'S manipulation.
- Create Virtual Machines
- Delete Virtual Machines
- List Virtual Machines
- Get Virtual Machines details
cd custom-apiserverCGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o artifacts/simple-image/virtual-machines-apiserverdocker build -t MYPREFIX/virtual-machines-apiserver:MYTAG ./artifacts/simple-image
docker push MYPREFIX/virtual-machines-apiserver:MYTAGWhere MYPREFIX is your Docker Hub username and MYTAG is the tag you want to use.
kubectl apply -f artifacts/example/ns.yaml
kubectl apply -f artifacts/exampleTest if the custom API server is running by checking the apiservices and the pods in the kube-system namespace:
kubectl get apiservices -n kube-system
kubectl get pods -n vmscd custom-controllermake docker-build IMG=MYPREFIX/virtual-machines-controller:MYTAGWhere MYPREFIX is your Docker Hub username and MYTAG is the tag you want to use.
docker push MYPREFIX/virtual-machines-controller:MYTAG- Create a Kubernetes secret manifest for your AWS credentials, then apply it:
apiVersion: v1
kind: Secret
metadata:
name: aws-credentials
namespace: custom-controller-system
type: Opaque
stringData:
access_key: <YOUR_AWS_ACCESS_KEY>
secret_key: <YOUR_AWS_SECRET_KEY>kubectl apply -f aws-credentials.yaml- Locate your operator’s deployment YAML file, typically in config/manager/manager.yaml. Change the image field to point to your custom controller image:
spec:
containers:
- name: manager
image: MYPREFIX/virtual-machines-controller:MYTAGThen apply the deployment:
make deploy IMG=MYPREFIX/virtual-machines-controller:MYTAG- Apply the RBAC rules:
kubectl apply -f virtualmachine-operator-permissions.yamlCheck if the custom controller is running by checking the pods in the custom-controller-system namespace
kubectl get pods -n custom-controller-systemTo create a Virtual Machine, apply the following manifest:
kubectl apply -f custom-apiserver/artifacts/virtualmachine/02-virtualmachine.yamlTo list all Virtual Machines, use the following command:
kubectl get virtualmachinesTo get the details of a specific Virtual Machine, use:
kubectl get virtualmachine <vm-name> -o yamlTo delete a Virtual Machine, use the following command:
kubectl delete virtualmachine <vm-name>This will remove the Virtual Machine from the cluster.