Skip to content

Instantly share code, notes, and snippets.

@danielkec
Last active March 5, 2021 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielkec/c1bb405108a537c908c66978573d66c8 to your computer and use it in GitHub Desktop.
Save danielkec/c1bb405108a537c908c66978573d66c8 to your computer and use it in GitHub Desktop.
verrazzano_microk8s.md

microk8s 1.18

alias kubectl='microk8s.kubectl'

sudo snap install microk8s --classic --channel=1.18/stable
microk8s start

Enable Use ServiceAccountToken volumes linkerd/linkerd2#3260 (comment) kubeflow/manifests#974

sudo echo -e '\n--service-account-issuer=api
--service-account-signing-key-file=${SNAP_DATA}/certs/serviceaccount.key
--service-account-api-audiences=api' >> /var/snap/microk8s/current/args/kube-apiserver
microk8s enable storage metallb
# For use by MetalLB, assign a range of IP addresses at the end of the network’s subnet CIDR range.

microk8s status # check addons are started
microk8s inspect # check api daemon is started

kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"

Verrazzano

https://verrazzano.io/docs/setup/install/installation/#install-the-verrazzano-platform-operator

kubectl apply -f https://github.com/verrazzano/verrazzano/releases/latest/download/operator.yaml
kubectl -n verrazzano-install rollout status deployment/verrazzano-platform-operator
kubectl apply -f - <<EOF
apiVersion: install.verrazzano.io/v1alpha1
kind: Verrazzano
metadata:
  name: example-verrazzano
spec:
  profile: dev
EOF

Check installation logs

kubectl logs -f \
    $( \
      kubectl get pod  \
          -l job-name=verrazzano-install-example-verrazzano \
          -o jsonpath="{.items[0].metadata.name}" \
    )

Deploy example Helidon

kubectl create namespace hello-helidon
kubectl label namespace hello-helidon verrazzano-managed=true
kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/master/examples/hello-helidon/hello-helidon-comp.yaml
kubectl apply -f https://raw.githubusercontent.com/verrazzano/verrazzano/master/examples/hello-helidon/hello-helidon-app.yaml

Save GW host

HOST=$(kubectl get gateway hello-helidon-hello-helidon-appconf-gw -n hello-helidon -o jsonpath='{.spec.servers[0].hosts[0]}')

Ping helidon

curl -X GET "https://${HOST}/greet"

Clean up k8s

microk8s reset snap remove --purge microk8s

@danielkec
Copy link
Author

danielkec commented Mar 5, 2021

curl -v $(kubectl -n hello-helidon get endpoints -o jsonpath='{$..subsets..ip}:{$..subsets..port}/greet')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment