CONTROL_PLANE_IP="192.168.11.61"talosctl gen secrets -o secrets.yaml
talosctl gen config --with-secrets secrets.yaml my-cluster https://$CONTROL_PLANE_IP:6443 \
--output-dir _out
talosctl -n $CONTROL_PLANE_IP disks --insecure
#modify disk#/dev/mmcblk0sed -i 's/sda/mmcblk0/g' _out/controlplane.yaml _out/worker.yaml
sed -i 's/\#\ allowSchedulingOnControlPlanes\:\ true/allowSchedulingOnControlPlanes\:\ true/g' _out/worker.yaml
sed -i 's/^\s*# allowSchedulingOnControlPlanes: true/ allowSchedulingOnControlPlanes: true/' _out/controlplane.yaml
#Save the file and fire up the control plane first:talosctl apply-config --insecure -n $CONTROL_PLANE_IP --file _out/controlplane.yaml
# 2. Run the Worker Nodestalosctl apply-config --insecure -n $CONTROL_PLANE_IP --file _out/worker.yaml
# 3. Bootstrap Etcd# export CONTROL_PLANE_IP=$TALOS_IPexportTALOSCONFIG="_out/talosconfig"talosctl config endpoint $CONTROL_PLANE_IPtalosctl config node $CONTROL_PLANE_IP#Now we will set the endpoints and nodes.talosctl --talosconfig _out/talosconfig config endpoint $CONTROL_PLANE_IPtalosctl --talosconfig _out/talosconfig config node $CONTROL_PLANE_IP#Bootstrap etcdtalosctl --talosconfig _out/talosconfig bootstrap -n $CONTROL_PLANE_IP#4. Access Talos Powered Kubernetes Cluster#Once the cluster is up, you can access and use it as desired to run the containerized workloads. But first, obtain the admin kubeconfigtalosctl --talosconfig _out/talosconfig kubeconfig .
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"chmod +x kubectl
sudo mv kubectl /usr/local/bin
mkdir -p $HOME/.kube
sudo cp -i kubeconfig $HOME/.kube/config
sudo chown $(id -u):$(id -g)$HOME/.kube/config
# View the nodes in the clusterkubectl get nodes -o wide
# View the pods:kubectl get pods -A
5. Deploy a Test Application on Kubernetes
To verify if the cluster is working properly, we can deploy a sample Nginx application. To achieve that, we can use the below manifest:
kubectl apply -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
EOF#View if the pods are running:kubectl get pods
#Expose the app with NodePort:kubectl expose deployment nginx-deployment --type=NodePort --port=80# Get the service port:kubectl get svc