-
Notifications
You must be signed in to change notification settings - Fork 1
Various helpful docs and bash scripts for Kubernetes and Docker deployments
Michael Tarng edited this page Feb 1, 2019
·
22 revisions
Samples:
az aks create --resource-group <resource-group> --name <aks-cluster-name> --node-count 1 --service-principal <service-principal-guid> --client-secret <secret-guid> --generate-ssh-keys
az aks get-credentials --resource-group <resource-group> --name <aks-cluster-name>
Kubectl References and Commands
Useful commands:
alias k='kubectl'
k config view
k get services
k describe pod <pod-name-or-prefix>
k logs <pod-name>
k port-forward <pod-name> 8080:8080
k apply -f deployment.yaml
k delete -f deployment.yaml
k exec -it <pod-name> -- sh
k port-forward -n prometheus svc/prometheus-server 9090:80
k port-forward -n grafana svc/grafana 3000:80
k get secret -n grafana grafana -o yaml
echo '<encoded byte64 str>' | base64 --decode
Azure Container Registry Documentation
kubectl create secret docker-registry <regcred-name> --docker-server=<repository-url> --docker-username <rbac-appId> --docker-password <rbac-password>
kubectl get secret <regcred-name> --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
kubectl get secret <regcred-name> --output=yaml
bash
FAB_VER=0.1.4
# Clone the Cloud Native Fabrikate stack
git clone https://github.com/timfpark/fabrikate-cloud-native/
cd fabrikate-cloud-native
# Download Fabrikate (assuming you are using MacOS and need a Darwin release)
curl https://github.com/Microsoft/fabrikate/releases/download/${FAB_VER}/fab-v${FAB_VER}-darwin-amd64.zip -Lo fab.zip
unzip fab.zip
rm fab.zip
# Generate k8s resources; neither command will actually install anything to your cluster
./fab install
./fab generate prod
# Apply the generate resources definitions
# You may encounter the following errors when applying the diff:
# Error from server (NotFound): error when creating "elasticsearch-fluentd-kibana/elasticsearch-curator.yaml": namespaces "elasticsearch" not found
# Error from server (NotFound): error when creating "prometheus-grafana/grafana.yaml": namespaces "grafana" not found
# These are caused due to the cluster not creating the namespaces in time before creating resources in them.
# `kubectl apply` is an idempotent function, so it is safe to retry the command below to try and redeploy after a few seconds.
cd generated/prod
kubectl apply --recursive -f .
- Managing Computing Resources
- Assign Memory Resources
- Using a private repository
- Kubernetes - Secrets
- Kubernetes - Distribute Credentials Securely Using Secrets
- Annotations