Thursday, November 14, 2019

creating a domain with WLST

in WLS 12.1 + the script no longer supports a silent installation

./ -silent -response response_file

see Document "Can be Run in Silent or Non-GUI Mode in Weblogic 12c ? (Doc ID 2370636.1) "

"The configuration tool only works in GUI mode with 12.1.x and above. In order to create a domain without using a GUI the WLST tool will need to be used. "

this is really stupid, 99% of Linux machines are headless

and using UI defeats automation

here how to create a domain with WLST:

but when you do:

selectTemplate('Base WebLogic Server Domain')

you get a

Caused by: 60708: Template not found.

60708: Found no templates with Base WebLogic Server Domain name and null version

60708: Select a different template.



do a showAvailableTemplates()

'20849: Available templates.\n20849: Currently available templates for loading: WebLogic Advanced Web Services for JAX-RPC Extension:\nWebLogic Advanced Web Services for JAX-WS Extension:\nWebLogic JAX-WS SOAP/JMS Extension:\nBasic WebLogic Server Domain:\nWebLogic Coherence Cluster Extension:\n\n20849: No action required.\n'

so the solution is

selectTemplate('Basic WebLogic Server Domain', '')

To find out more info on the domain template (like wls.jar) open its template-info.xml

Saturday, November 9, 2019

kubernetes quotas

kubectl create namespace pippo
kubectl create quota myhq --hard=cpu=1,memory=1G,pods=2 --namespace=pippo
kubectl run --restart=Never busybox --image=busybox --namespace=pippo

Error from server (Forbidden): pods "busybox" is forbidden: failed quota: myhq: must specify cpu,memory

You can create your pod with requests and limits:

kubectl run --restart=Never busybox --image=busybox --namespace=pippo --limits=cpu=100m,memory=512Mi --requests=cpu=50m,memory=256Mi --dry-run -o yaml > mypod.yaml

  - image: busybox
    imagePullPolicy: IfNotPresent
    name: busybox
        cpu: 100m
        memory: 512Mi
        cpu: 50m
        memory: 256Mi

obviously all values in "requests" must be <= values in limits

busybox docker image

docker pull busybox
docker inspect busybox

if I see in the Config section (don't look at ContainerConfig ) the Cmd is simply "sh"

which means that if I do

kubectl run --restart=Never busybox -it --image=busybox

I simply get a shell.

If I create a pod who executes simply "env"

kubectl run --restart=Never busybox --image=busybox -- env

and then "inspect" it

kubectl get pod busybox -o yaml

I see that the container got the entry:

  - env

and since the "args" are simply appended to the default command defined in the container ("If you define args, but do not define a command, the default command is used with your new arguments.")... it's equivalent to specifying:

command: ["sh", "-c"]
args: ["env"]

don't forget the "-c", otherwise you get "sh: can't open 'env': No such file or directory"

NB: if with "kubectl run" you specify --command

kubectl run busybox --image=busybox --restart=Never --command -- env

then "command" instead of "args" will be generated:

  - command:
    - env
    image: busybox
    name: busybox

This aspect of containers/pods (how to run a command with arguments) is rather confusing and poorly engineered.