Last active
April 15, 2022 09:43
-
-
Save quotidian-ennui/575546ba89ea0f4dfe8276fb7a845ef8 to your computer and use it in GitHub Desktop.
microk8s activemq descriptors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: activemq | |
name: activemq | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: activemq | |
template: | |
metadata: | |
labels: | |
app: activemq | |
spec: | |
containers: | |
- name: activemq | |
image: lewinc/activemq:latest-liberica-alpine | |
imagePullPolicy: Always | |
env: | |
- name: ACTIVEMQ_OPTS | |
value: "-Djetty.host=0.0.0.0" | |
resources: | |
limits: | |
cpu: 400m | |
memory: "512M" | |
requests: | |
cpu: 200m | |
memory: "256M" | |
ports: | |
- containerPort: 8161 | |
- containerPort: 61616 | |
- containerPort: 5672 | |
imagePullSecrets: | |
- name: dockerhub | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: activemq | |
labels: | |
app: activemq | |
spec: | |
selector: | |
app: activemq | |
ports: | |
- name: dashboard | |
port: 8161 | |
targetPort: 8161 | |
protocol: TCP | |
- name: openwire | |
port: 61616 | |
targetPort: 61616 | |
protocol: TCP | |
- name: amqp | |
port: 5672 | |
targetPort: 5672 | |
protocol: TCP | |
type: ClusterIP | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: activemq-admin-ingress | |
labels: | |
app: activemq | |
spec: | |
ingressClassName: public | |
rules: | |
- host: activemq.microk8s.local | |
http: | |
paths: | |
- path: / | |
pathType: ImplementationSpecific | |
backend: | |
service: | |
name: activemq | |
port: | |
number: 8161 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mk8s() { | |
local action=$1 | |
case "$action" in | |
start ) | |
multipass start microk8s-vm | |
microk8s start | |
microk8s config > $HOME/AppData/Local/MicroK8s/config | |
mk8s_host=$(multipass info microk8s-vm | grep IPv4 | awk '{ print $2}') | |
# This does mean we get the secure desktop yes/no prompt. | |
sudo $HOME/bin/microk8s-hosts.ps1 -ip "$mk8s_host" | |
;; | |
config ) | |
microk8s config > $HOME/AppData/Local/MicroK8s/config | |
;; | |
hosts ) | |
mk8s_host=$(multipass info microk8s-vm | grep IPv4 | awk '{ print $2}') | |
# This does mean we get the secure desktop yes/no prompt. | |
sudo $HOME/bin/microk8s-hosts.ps1 -ip "$mk8s_host" | |
;; | |
token ) | |
# Gives you the token for the dashboard | |
## using get secret + go template would be better but falls foul of blog templating... | |
microk8s kubectl -n kube-system get secret $(microk8s kubectl -n kube-system get sa/default -o jsonpath="{.secrets[0].name}") -o go-template="{{.data.token | base64decode}}" | |
;; | |
info ) | |
microk8s kubectl describe node microk8s-vm | |
;; | |
ip ) | |
# jq + tr or grep + awk... | |
# multipass info microk8s-vm --format json | jq '.info."microk8s-vm".ipv4[0]' | tr -d '"' | |
multipass info microk8s-vm | grep IPv4 | awk '{ print $2}' | |
;; | |
dashboard ) | |
# Starts chrome | |
local ip=$(multipass info microk8s-vm | grep IPv4 | awk '{ print $2 }') | |
local port=$(microk8s kubectl -n kube-system get services -l k8s-app=kubernetes-dashboard --no-headers=true -o custom-columns="Port:.spec.ports[0].nodePort") | |
# local port=$(microk8s kubectl -n kube-system get services -l k8s-app=kubernetes-dashboard --no-headers=true | awk '{ print $5 }' | awk -F: '{ print $2 }' | awk -F"/" '{ print $1 }') | |
start chrome --ignore-certificate-errors --incognito -new-tab "https://$ip:$port" | |
;; | |
*) | |
microk8s $@ | |
;; | |
esac | |
} | |
alias mkctl='microk8s kubectl' | |
# because you want to run telnet from within the K8S cluster - https://github.com/mcwarman/k8s-jump-box | |
alias k8ssh='winpty microk8s kubectl run jump-box --image=ghcr.io/mcwarman/k8s-jump-box:1 -i -t --image-pull-policy=Always --restart=Never --rm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
clusterName: "elasticsearch" | |
nodeGroup: "master" | |
roles: | |
master: "true" | |
ingest: "true" | |
data: "true" | |
replicas: 1 | |
# Disable privileged init Container creation. | |
sysctlInitContainer: | |
enabled: false | |
# Restrict the use of the memory-mapping when sysctlInitContainer is disabled. | |
esConfig: | |
elasticsearch.yml: | | |
node.store.allow_mmap: false | |
# Permit co-located instances for solitary minikube virtual machines. | |
antiAffinity: "soft" | |
# Shrink default JVM heap. | |
esJavaOpts: "-Xmx1568m -Xms1568m" | |
# Allocate smaller chunks of memory per pod. | |
resources: | |
requests: | |
cpu: "100m" | |
memory: "2Gi" | |
limits: | |
cpu: "1000m" | |
memory: "2Gi" | |
# Request smaller persistent volumes. | |
volumeClaimTemplate: | |
accessModes: [ "ReadWriteOnce" ] | |
storageClassName: "microk8s-hostpath" | |
resources: | |
requests: | |
storage: 100M | |
ingress: | |
enabled: true | |
className: "public" | |
pathtype: ImplementationSpecific | |
hosts: | |
- host: elasticsearch.microk8s.local | |
paths: | |
- path: / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
ingress: | |
enabled: true | |
className: public | |
hosts: | |
- host: kibana.microk8s.local | |
paths: | |
- path: / | |
resources: | |
requests: | |
cpu: "100m" | |
memory: "1Gi" | |
limits: | |
cpu: "1000m" | |
memory: "2Gi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([string]$ip = "127.0.0.1") | |
# Adds entry to the hosts file. | |
# Requires -RunAsAdministrator | |
$hostsFilePath = "$($Env:WinDir)\system32\Drivers\etc\hosts" | |
$hostsFile = Get-Content $hostsFilePath | |
$toBeAdded="microk8s.local registry.microk8s.local kibana.microk8s.local activemq.microk8s.local elasticsearch.microk8s.local" | |
$existing = "microk8s.local" | |
Write-Host "Removing $existing from hosts file" -ForegroundColor Gray | |
$escapedHostname = [Regex]::Escape($existing) | |
If (($hostsFile) -match ".*\s+$escapedHostname.*") { | |
Write-Host "$Hostname - removing from hosts file... " -ForegroundColor Yellow | |
$hostsFile -notmatch ".*\s+$escapedHostname.*" | Out-File $hostsFilePath | |
} | |
Write-Host "Adding $ip for microk8s to hosts file" -ForegroundColor Gray | |
Add-Content -Encoding UTF8 $hostsFilePath ("$ip".PadRight(20, " ") + "$toBeAdded") | |
Write-Host "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"op": "add", "path": "/spec/template/spec/containers/0/ports/-", "value":{"name":"activemq-61616","containerPort":61616,"hostPort":61616,"protocol":"TCP"}}, | |
{"op": "add", "path": "/spec/template/spec/containers/0/ports/-", "value":{"name":"activemq-5672","containerPort":5672,"hostPort":5672,"protocol":"TCP"}} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data: | |
5672: "quotidian-ennui/activemq:5672" | |
61616: "quotidian-ennui/activemq:61616" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment