Developing with MicroK8s
With MicroK8s installed and configured, let’s dig into how we might deploy applications and services on our cluster. If you have prior experience with Kubernetes, you will find the process very familiar.
Deploying applications
Deploying applications to your MicroK8s cluster is seamless, whether using YAML manifests or Helm charts. For instance, to deploy a simple Nginx web server, run the following:
ken@monster:~$ microk8s kubectl apply -f https://k8s.io/examples/application/deployment.yaml
This command creates a deployment and service for Nginx, making it accessible within your cluster.
Accessing services
MicroK8s offers several ways to access services running within your cluster:
- Port forwarding:
kubectl port-forward service/nginx 8080:80
forwards traffic from your local port8080
to the Nginx service running in the cluster. This allows you to access the service from your host machine as if running locally.
...